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

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

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

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

For the same syntacticreason, it is permitted to take the address of a library function even if it is also defined asa macro.161) The use of #undef to remove any macro definition will also ensure that anactual function is referred to. Any invocation of a library function that is implemented asa macro shall expand to code that evaluates each of its arguments exactly once, fullyprotected by parentheses where necessary, so it is generally safe to use arbitraryexpressions as arguments.162) Likewise, those function-like macros described in thefollowing subclauses may be invoked in an expression anywhere a function with acompatible return type could be called.163) All object-like macros listed as expanding tointeger constant expressions shall additionally be suitable for use in #if preprocessingdirectives.2Provided that a library function can be declared without reference to any type defined in aheader, it is also permissible to declare the function and use it without including itsassociated header.3There is a sequence point immediately before a library function returns.4The functions in the standard library are not guaranteed to be reentrant and may modifyobjects with static storage duration.164)161) This means that an implementation shall provide an actual function for each library function, even if italso provides a macro for that function.162) Such macros might not contain the sequence points that the corresponding function calls do.163) Because external identifiers and some macro names beginning with an underscore are reserved,implementations may provide special semantics for such names.

For example, the identifier_BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, theappropriate header could specify#define abs(x) _BUILTIN_abs(x)for a compiler whose code generator will accept it.In this manner, a user desiring to guarantee that a given library function such as abs will be a genuinefunction may write#undef abswhether the implementation’s header provides a macro implementation of abs or a built-inimplementation. The prototype for the function, which precedes and is hidden by any macrodefinition, is thereby revealed also.164) Thus, a signal handler cannot, in general, call standard library functions.§7.1.4Library167ISO/IEC 9899:TC35EXAMPLECommittee Draft — Septermber 7, 2007WG14/N1256The function atoi may be used in any of several ways:— by use of its associated header (possibly generating a macro expansion)#include <stdlib.h>const char *str;/* ...

*/i = atoi(str);— by use of its associated header (assuredly generating a true function reference)#include <stdlib.h>#undef atoiconst char *str;/* ... */i = atoi(str);or#include <stdlib.h>const char *str;/* ... */i = (atoi)(str);— by explicit declarationextern int atoi(const char *);const char *str;/* ... */i = atoi(str);168Library§7.1.4WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.2 Diagnostics <assert.h>1The header <assert.h> defines the assert macro and refers to another macro,NDEBUGwhich is not defined by <assert.h>. If NDEBUG is defined as a macro name at thepoint in the source file where <assert.h> is included, the assert macro is definedsimply as#define assert(ignore) ((void)0)The assert macro is redefined according to the current state of NDEBUG each time that<assert.h> is included.2The assert macro shall be implemented as a macro, not as an actual function.

If themacro definition is suppressed in order to access an actual function, the behavior isundefined.7.2.1 Program diagnostics7.2.1.1 The assert macroSynopsis1#include <assert.h>void assert(scalar expression);Description2The assert macro puts diagnostic tests into programs; it expands to a void expression.When it is executed, if expression (which shall have a scalar type) is false (that is,compares equal to 0), the assert macro writes information about the particular call thatfailed (including the text of the argument, the name of the source file, the source linenumber, and the name of the enclosing function — the latter are respectively the values ofthe preprocessing macros _ _FILE_ _ and _ _LINE_ _ and of the identifier_ _func_ _) on the standard error stream in an implementation-defined format.165) Itthen calls the abort function.Returns3The assert macro returns no value.Forward references: the abort function (7.20.4.1).165) The message written might be of the form:Assertion failed: expression, function abc, file xyz, line nnn.§7.2.1.1Library169ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.3 Complex arithmetic <complex.h>7.3.1 Introduction1The header <complex.h> defines macros and declares functions that support complexarithmetic.166) Each synopsis specifies a family of functions consisting of a principalfunction with one or more double complex parameters and a double complex ordouble return value; and other functions with the same name but with f and l suffixeswhich are corresponding functions with float and long double parameters andreturn values.2The macrocomplexexpands to _Complex; the macro_Complex_Iexpands to a constant expression of type const float _Complex, with the value ofthe imaginary unit.167)3The macrosimaginaryand_Imaginary_Iare defined if and only if the implementation supports imaginary types;168) if defined,they expand to _Imaginary and a constant expression of type const float_Imaginary with the value of the imaginary unit.4The macroIexpands to either _Imaginary_I or _Complex_I.

If _Imaginary_I is notdefined, I shall expand to _Complex_I.5Notwithstanding the provisions of 7.1.3, a program may undefine and perhaps thenredefine the macros complex, imaginary, and I.Forward references: IEC 60559-compatible complex arithmetic (annex G).166) See ‘‘future library directions’’ (7.26.1).167) The imaginary unit is a number i such that i 2= −1.168) A specification for imaginary types is in informative annex G.170Library§7.3.1WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.3.2 Conventions1Values are interpreted as radians, not degrees.

An implementation may set errno but isnot required to.7.3.3 Branch cuts1Some of the functions below have branch cuts, across which the function isdiscontinuous. For implementations with a signed zero (including all IEC 60559implementations) that follow the specifications of annex G, the sign of zero distinguishesone side of a cut from another so the function is continuous (except for formatlimitations) as the cut is approached from either side. For example, for the square rootfunction, which has a branch cut along the negative real axis, the top of the cut, withimaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, withimaginary part −0, maps to the negative imaginary axis.2Implementations that do not support a signed zero (see annex F) cannot distinguish thesides of branch cuts. These implementations shall map a cut so the function is continuousas the cut is approached coming around the finite endpoint of the cut in a counterclockwise direction.

(Branch cuts for the functions specified here have just one finiteendpoint.) For example, for the square root function, coming counter clockwise aroundthe finite endpoint of the cut along the negative real axis approaches the cut from above,so the cut maps to the positive imaginary axis.7.3.4 The CX_LIMITED_RANGE pragmaSynopsis1#include <complex.h>#pragma STDC CX_LIMITED_RANGE on-off-switchDescription2The usual mathematical formulas for complex multiply, divide, and absolute value areproblematic because of their treatment of infinities and because of undue overflow andunderflow.

The CX_LIMITED_RANGE pragma can be used to inform theimplementation that (where the state is ‘‘on’’) the usual mathematical formulas areacceptable.169) The pragma can occur either outside external declarations or preceding allexplicit declarations and statements inside a compound statement. When outside external169) The purpose of the pragma is to allow the implementation to use the formulas:(x + iy) × (u + iv) = (xu − yv) + i(yu + xv)(x + iy) / (u + iv) = [(xu + yv) + i(yu − xv)]/(u2 + v 2 )| x + iy | = √x 2 + y2where the programmer can determine they are safe.§7.3.4Library171ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256declarations, the pragma takes effect from its occurrence until anotherCX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.When inside a compound statement, the pragma takes effect from its occurrence untilanother CX_LIMITED_RANGE pragma is encountered (including within a nestedcompound statement), or until the end of the compound statement; at the end of acompound statement the state for the pragma is restored to its condition just before thecompound statement.

If this pragma is used in any other context, the behavior isundefined. The default state for the pragma is ‘‘off’’.7.3.5 Trigonometric functions7.3.5.1 The cacos functionsSynopsis1#include <complex.h>double complex cacos(double complex z);float complex cacosf(float complex z);long double complex cacosl(long double complex z);Description2The cacos functions compute the complex arc cosine of z, with branch cuts outside theinterval [−1, +1] along the real axis.Returns3The cacos functions return the complex arc cosine value, in the range of a stripmathematically unbounded along the imaginary axis and in the interval [0, π ] along thereal axis.7.3.5.2 The casin functionsSynopsis1#include <complex.h>double complex casin(double complex z);float complex casinf(float complex z);long double complex casinl(long double complex z);Description2The casin functions compute the complex arc sine of z, with branch cuts outside theinterval [−1, +1] along the real axis.Returns3The casin functions return the complex arc sine value, in the range of a stripmathematically unbounded along the imaginary axis and in the interval [−π /2, +π /2]along the real axis.172Library§7.3.5.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.3.5.3 The catan functionsSynopsis1#include <complex.h>double complex catan(double complex z);float complex catanf(float complex z);long double complex catanl(long double complex z);Description2The catan functions compute the complex arc tangent of z, with branch cuts outside theinterval [−i, +i] along the imaginary axis.Returns3The catan functions return the complex arc tangent value, in the range of a stripmathematically unbounded along the imaginary axis and in the interval [−π /2, +π /2]along the real axis.7.3.5.4 The ccos functionsSynopsis1#include <complex.h>double complex ccos(double complex z);float complex ccosf(float complex z);long double complex ccosl(long double complex z);Description2The ccos functions compute the complex cosine of z.Returns3The ccos functions return the complex cosine value.7.3.5.5 The csin functionsSynopsis1#include <complex.h>double complex csin(double complex z);float complex csinf(float complex z);long double complex csinl(long double complex z);Description2The csin functions compute the complex sine of z.Returns3The csin functions return the complex sine value.§7.3.5.5Library173ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.3.5.6 The ctan functionsSynopsis1#include <complex.h>double complex ctan(double complex z);float complex ctanf(float complex z);long double complex ctanl(long double complex z);Description2The ctan functions compute the complex tangent of z.Returns3The ctan functions return the complex tangent value.7.3.6 Hyperbolic functions7.3.6.1 The cacosh functionsSynopsis1#include <complex.h>double complex cacosh(double complex z);float complex cacoshf(float complex z);long double complex cacoshl(long double complex z);Description2The cacosh functions compute the complex arc hyperbolic cosine of z, with a branchcut at values less than 1 along the real axis.Returns3The cacosh functions return the complex arc hyperbolic cosine value, in the range of ahalf-strip of non-negative values along the real axis and in the interval [−iπ , +iπ ] alongthe imaginary axis.7.3.6.2 The casinh functionsSynopsis1#include <complex.h>double complex casinh(double complex z);float complex casinhf(float complex z);long double complex casinhl(long double complex z);Description2The casinh functions compute the complex arc hyperbolic sine of z, with branch cutsoutside the interval [−i, +i] along the imaginary axis.174Library§7.3.6.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Returns3The casinh functions return the complex arc hyperbolic sine value, in the range of astrip mathematically unbounded along the real axis and in the interval [−iπ /2, +iπ /2]along the imaginary axis.7.3.6.3 The catanh functionsSynopsis1#include <complex.h>double complex catanh(double complex z);float complex catanhf(float complex z);long double complex catanhl(long double complex z);Description2The catanh functions compute the complex arc hyperbolic tangent of z, with branchcuts outside the interval [−1, +1] along the real axis.Returns3The catanh functions return the complex arc hyperbolic tangent value, in the range of astrip mathematically unbounded along the real axis and in the interval [−iπ /2, +iπ /2]along the imaginary axis.7.3.6.4 The ccosh functionsSynopsis1#include <complex.h>double complex ccosh(double complex z);float complex ccoshf(float complex z);long double complex ccoshl(long double complex z);Description2The ccosh functions compute the complex hyperbolic cosine of z.Returns3The ccosh functions return the complex hyperbolic cosine value.7.3.6.5 The csinh functionsSynopsis1#include <complex.h>double complex csinh(double complex z);float complex csinhf(float complex z);long double complex csinhl(long double complex z);§7.3.6.5Library175ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Description2The csinh functions compute the complex hyperbolic sine of z.Returns3The csinh functions return the complex hyperbolic sine value.7.3.6.6 The ctanh functionsSynopsis1#include <complex.h>double complex ctanh(double complex z);float complex ctanhf(float complex z);long double complex ctanhl(long double complex z);Description2The ctanh functions compute the complex hyperbolic tangent of z.Returns3The ctanh functions return the complex hyperbolic tangent value.7.3.7 Exponential and logarithmic functions7.3.7.1 The cexp functionsSynopsis1#include <complex.h>double complex cexp(double complex z);float complex cexpf(float complex z);long double complex cexpl(long double complex z);Description2The cexp functions compute the complex base-e exponential of z.Returns3The cexp functions return the complex base-e exponential value.7.3.7.2 The clog functionsSynopsis1#include <complex.h>double complex clog(double complex z);float complex clogf(float complex z);long double complex clogl(long double complex z);176Library§7.3.7.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Description2The clog functions compute the complex natural (base-e) logarithm of z, with a branchcut along the negative real axis.Returns3The clog functions return the complex natural logarithm value, in the range of a stripmathematically unbounded along the real axis and in the interval [−iπ , +iπ ] along theimaginary axis.7.3.8 Power and absolute-value functions7.3.8.1 The cabs functionsSynopsis1#include <complex.h>double cabs(double complex z);float cabsf(float complex z);long double cabsl(long double complex z);Description2The cabs functions compute the complex absolute value (also called norm, modulus, ormagnitude) of z.Returns3The cabs functions return the complex absolute value.7.3.8.2 The cpow functionsSynopsis1#include <complex.h>double complex cpow(double complex x, double complex y);float complex cpowf(float complex x, float complex y);long double complex cpowl(long double complex x,long double complex y);Description2The cpow functions compute the complex power function xy , with a branch cut for thefirst parameter along the negative real axis.Returns3The cpow functions return the complex power function value.§7.3.8.2Library177ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.3.8.3 The csqrt functionsSynopsis1#include <complex.h>double complex csqrt(double complex z);float complex csqrtf(float complex z);long double complex csqrtl(long double complex z);Description2The csqrt functions compute the complex square root of z, with a branch cut along thenegative real axis.Returns3The csqrt functions return the complex square root value, in the range of the right halfplane (including the imaginary axis).7.3.9 Manipulation functions7.3.9.1 The carg functionsSynopsis1#include <complex.h>double carg(double complex z);float cargf(float complex z);long double cargl(long double complex z);Description2The carg functions compute the argument (also called phase angle) of z, with a branchcut along the negative real axis.Returns3The carg functions return the value of the argument in the interval [−π , +π ].7.3.9.2 The cimag functionsSynopsis1#include <complex.h>double cimag(double complex z);float cimagf(float complex z);long double cimagl(long double complex z);178Library§7.3.9.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Description2The cimag functions compute the imaginary part of z.170)Returns3The cimag functions return the imaginary part value (as a real).7.3.9.3 The conj functionsSynopsis1#include <complex.h>double complex conj(double complex z);float complex conjf(float complex z);long double complex conjl(long double complex z);Description2The conj functions compute the complex conjugate of z, by reversing the sign of itsimaginary part.Returns3The conj functions return the complex conjugate value.7.3.9.4 The cproj functionsSynopsis1#include <complex.h>double complex cproj(double complex z);float complex cprojf(float complex z);long double complex cprojl(long double complex z);Description2The cproj functions compute a projection of z onto the Riemann sphere: z projects toz except that all complex infinities (even those with one infinite part and one NaN part)project to positive infinity on the real axis.

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

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

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

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