Главная » Просмотр файлов » Стандарт языка Си С99 TC

Стандарт языка Си С99 TC (1113411), страница 81

Файл №1113411 Стандарт языка Си С99 TC (Стандарт языка Си С99 + TC) 81 страницаСтандарт языка Си С99 TC (1113411) страница 812019-04-24СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 81)

Ifan argument is imaginary, the macro expands to an expression whose type is real,imaginary, or complex, as appropriate for the particular function: if the argument isimaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; thetypes of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; andthe types of the others are complex.2Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of realfunctions:cos(iy)sin(iy)tan(iy)cosh(iy)sinh(iy)tanh(iy)asin(iy)atan(iy)asinh(iy)atanh(iy)480==========cosh(y)i sinh(y)i tanh(y)cos(y)i sin(y)i tan(y)i asinh(y)i atanh(y)i asin(y)i atan(y)IEC 60559-compatible complex arithmetic§G.7WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Annex H(informative)Language independent arithmeticH.1 Introduction1This annex documents the extent to which the C language supports the ISO/IEC 10967−1standard for language-independent arithmetic (LIA−1).

LIA−1 is more general thanIEC 60559 (annex F) in that it covers integer and diverse floating-point arithmetics.H.2 Types1The relevant C arithmetic types meet the requirements of LIA−1 types if animplementation adds notification of exceptional arithmetic operations and meets the 1unit in the last place (ULP) accuracy requirement (LIA−1 subclause 5.2.8).H.2.1 Boolean type1The LIA−1 data type Boolean is implemented by the C data type bool with values oftrue and false, all from <stdbool.h>.H.2.2 Integer types1The signed C integer types int, long int, long long int, and the correspondingunsigned types are compatible with LIA−1.

If an implementation adds support for theLIA−1 exceptional values ‘‘integer_overflow’’ and ‘‘undefined’’, then those types areLIA−1 conformant types. C’s unsigned integer types are ‘‘modulo’’ in the LIA−1 sensein that overflows or out-of-bounds results silently wrap. An implementation that definessigned integer types as also being modulo need not detect integer overflow, in which case,only integer divide-by-zero need be detected.2The parameters for the integer data types can be accessed by the following:3maxintINT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,ULLONG_MAXminintINT_MIN, LONG_MIN, LLONG_MINThe parameter ‘‘bounded’’ is always true, and is not provided. The parameter ‘‘minint’’is always 0 for the unsigned types, and is not provided for those types.§H.2.2Language independent arithmetic481ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256H.2.2.1 Integer operations1The integer operations on integer types are the following:addIx + ysubIx - ymulIx * ydivI, divtIx / yremI, remtIx % ynegI-xabsIabs(x), labs(x), llabs(x)eqIx == yneqIx != ylssIx < yleqIx <= ygtrIx > ygeqIx >= ywhere x and y are expressions of the same integer type.H.2.3 Floating-point types1The C floating-point types float, double, and long double are compatible withLIA−1.

If an implementation adds support for the LIA−1 exceptional values‘‘underflow’’, ‘‘floating_overflow’’, and ‘‘"undefined’’, then those types are conformantwith LIA−1. An implementation that uses IEC 60559 floating-point formats andoperations (see annex F) along with IEC 60559 status flags and traps has LIA−1conformant types.H.2.3.1 Floating-point parameters12The parameters for a floating point data type can be accessed by the following:rFLT_RADIXpFLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIGemaxFLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXPeminFLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXPThe derived constants for the floating point types are accessed by the following:482Language independent arithmetic§H.2.3.1WG14/N1256Committee Draft — Septermber 7, 2007fmaxFLT_MAX, DBL_MAX, LDBL_MAXfminNFLT_MIN, DBL_MIN, LDBL_MINepsilonFLT_EPSILON, DBL_EPSILON, LDBL_EPSILONrnd_styleFLT_ROUNDSISO/IEC 9899:TC3H.2.3.2 Floating-point operations1The floating-point operations on floating-point types are the following:addFx + ysubFx - ymulFx * ydivFx / ynegF-xabsFfabsf(x), fabs(x), fabsl(x)exponentF1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)scaleFscalbnf(x, n), scalbn(x, n), scalbnl(x, n),scalblnf(x, li), scalbln(x, li), scalblnl(x, li)intpartFmodff(x, &y), modf(x, &y), modfl(x, &y)fractpartFmodff(x, &y), modf(x, &y), modfl(x, &y)eqFx == yneqFx != ylssFx < yleqFx <= ygtrFx > ygeqFx >= ywhere x and y are expressions of the same floating point type, n is of type int, and liis of type long int.H.2.3.3 Rounding styles1The C Standard requires all floating types to use the same radix and rounding style, sothat only one identifier for each is provided to map to LIA−1.2The FLT_ROUNDS parameter can be used to indicate the LIA−1 rounding styles:truncate§H.2.3.3FLT_ROUNDS == 0Language independent arithmetic483ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007nearestFLT_ROUNDS == 1otherFLT_ROUNDS != 0 && FLT_ROUNDS != 1WG14/N1256provided that an implementation extends FLT_ROUNDS to cover the rounding style usedin all relevant LIA−1 operations, not just addition as in C.H.2.4 Type conversions1The LIA−1 type conversions are the following type casts:cvtI’ → I(int)i, (long int)i, (long long int)i,(unsigned int)i, (unsigned long int)i,(unsigned long long int)icvtF → I(int)x, (long int)x, (long long int)x,(unsigned int)x, (unsigned long int)x,(unsigned long long int)xcvtI → F(float)i, (double)i, (long double)icvtF’ → F(float)x, (double)x, (long double)x2In the above conversions from floating to integer, the use of (cast)x can be replaced with(cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),(cast)ceil(x), or (cast)floor(x).

In addition, C’s floating-point to integerconversion functions, lrint(), llrint(), lround(), and llround(), can beused. They all meet LIA−1’s requirements on floating to integer rounding for in-rangevalues. For out-of-range values, the conversions shall silently wrap for the modulo types.3The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,fmod( fabs(rint(x)), 65536.0 ) or (0.0 <= (y = fmod( rint(x),65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0to 65535.0 which can then be cast to unsigned short int.

But, theremainder() function is not useful for doing silent wrapping to signed integer types,e.g., remainder( rint(x), 65536.0 ) will compute an integer value in therange −32767.0 to +32768.0 which is not, in general, in the range of signed shortint.4C’s conversions (casts) from floating-point to floating-point can meet LIA−1requirements if an implementation uses round-to-nearest (IEC 60559 default).5C’s conversions (casts) from integer to floating-point can meet LIA−1 requirements if animplementation uses round-to-nearest.484Language independent arithmetic§H.2.4WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3H.3 Notification1Notification is the process by which a user or program is informed that an exceptionalarithmetic operation has occurred. C’s operations are compatible with LIA−1 in that Callows an implementation to cause a notification to occur when any arithmetic operationreturns an exceptional value as defined in LIA−1 clause 5.H.3.1 Notification alternatives1LIA−1 requires at least the following two alternatives for handling of notifications:setting indicators or trap-and-terminate.

LIA−1 allows a third alternative: trap-andresume.2An implementation need only support a given notification alternative for the entireprogram. An implementation may support the ability to switch between notificationalternatives during execution, but is not required to do so. An implementation canprovide separate selection for each kind of notification, but this is not required.3C allows an implementation to provide notification. C’s SIGFPE (for traps) andFE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)can provide LIA−1 notification.4C’s signal handlers are compatible with LIA−1. Default handling of SIGFPE canprovide trap-and-terminate behavior, except for those LIA−1 operations implemented bymath library function calls. User-provided signal handlers for SIGFPE allow for trapand-resume behavior with the same constraint.H.3.1.1 Indicators1C’s <fenv.h> status flags are compatible with the LIA−1 indicators.2The following mapping is for floating-point types:3undefinedFE_INVALID, FE_DIVBYZEROfloating_overflowFE_OVERFLOWunderflowFE_UNDERFLOWThe floating-point indicator interrogation and manipulation operations are:set_indicatorsferaiseexcept(i)clear_indicatorsfeclearexcept(i)test_indicatorsfetestexcept(i)current_indicatorsfetestexcept(FE_ALL_EXCEPT)where i is an expression of type int representing a subset of the LIA−1 indicators.4C allows an implementation to provide the following LIA−1 required behavior: atprogram termination if any indicator is set the implementation shall send an unambiguous§H.3.1.1Language independent arithmetic485ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256and ‘‘hard to ignore’’ message (see LIA−1 subclause 6.1.2)5LIA−1 does not make the distinction between floating-point and integer for ‘‘undefined’’.This documentation makes that distinction because <fenv.h> covers only the floatingpoint indicators.H.3.1.2 Traps1C is compatible with LIA−1’s trap requirements for arithmetic operations, but not formath library functions (which are not permitted to generate any externally visibleexceptional conditions).

Характеристики

Тип файла
PDF-файл
Размер
3,61 Mb
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6390
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее