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

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

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

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

*/fesetround(save_round);/* ... */}7.6.4 Environment1The functions in this section manage the floating-point environment — status flags andcontrol modes — as one entity.7.6.4.1 The fegetenv functionSynopsis1#include <fenv.h>int fegetenv(fenv_t *envp);Description2The fegetenv function attempts to store the current floating-point environment in theobject pointed to by envp.Returns3The fegetenv function returns zero if the environment was successfully stored.Otherwise, it returns a nonzero value.7.6.4.2 The feholdexcept functionSynopsis1#include <fenv.h>int feholdexcept(fenv_t *envp);Description2The feholdexcept function saves the current floating-point environment in the objectpointed to by envp, clears the floating-point status flags, and then installs a non-stop(continue on floating-point exceptions) mode, if available, for all floating-pointexceptions.189)194Library§7.6.4.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Returns3The feholdexcept function returns zero if and only if non-stop floating-pointexception handling was successfully installed.7.6.4.3 The fesetenv functionSynopsis1#include <fenv.h>int fesetenv(const fenv_t *envp);Description2The fesetenv function attempts to establish the floating-point environment representedby the object pointed to by envp.

The argument envp shall point to an object set by acall to fegetenv or feholdexcept, or equal a floating-point environment macro.Note that fesetenv merely installs the state of the floating-point status flagsrepresented through its argument, and does not raise these floating-point exceptions.Returns3The fesetenv function returns zero if the environment was successfully established.Otherwise, it returns a nonzero value.7.6.4.4 The feupdateenv functionSynopsis1#include <fenv.h>int feupdateenv(const fenv_t *envp);Description2The feupdateenv function attempts to save the currently raised floating-pointexceptions in its automatic storage, install the floating-point environment represented bythe object pointed to by envp, and then raise the saved floating-point exceptions.

Theargument envp shall point to an object set by a call to feholdexcept or fegetenv,or equal a floating-point environment macro.Returns3The feupdateenv function returns zero if all the actions were successfully carried out.Otherwise, it returns a nonzero value.189) IEC 60559 systems have a default non-stop mode, and typically at least one other mode for traphandling or aborting; if the system provides only the non-stop mode then installing it is trivial. Forsuch systems, the feholdexcept function can be used in conjunction with the feupdateenvfunction to write routines that hide spurious floating-point exceptions from their callers.§7.6.4.4Library195ISO/IEC 9899:TC34EXAMPLECommittee Draft — Septermber 7, 2007WG14/N1256Hide spurious underflow floating-point exceptions:#include <fenv.h>double f(double x){#pragma STDC FENV_ACCESS ONdouble result;fenv_t save_env;if (feholdexcept(&save_env))return /* indication of an environmental problem */;// compute resultif (/* test spurious underflow */)if (feclearexcept(FE_UNDERFLOW))return /* indication of an environmental problem */;if (feupdateenv(&save_env))return /* indication of an environmental problem */;return result;}196Library§7.6.4.4WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.7 Characteristics of floating types <float.h>1The header <float.h> defines several macros that expand to various limits andparameters of the standard floating-point types.2The macros, their meanings, and the constraints (or restrictions) on their values are listedin 5.2.4.2.2.§7.7Library197ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.8 Format conversion of integer types <inttypes.h>1The header <inttypes.h> includes the header <stdint.h> and extends it withadditional facilities provided by hosted implementations.2It declares functions for manipulating greatest-width integers and converting numericcharacter strings to greatest-width integers, and it declares the typeimaxdiv_twhich is a structure type that is the type of the value returned by the imaxdiv function.For each type declared in <stdint.h>, it defines corresponding macros for conversionspecifiers for use with the formatted input/output functions.190)Forward references: integer types <stdint.h> (7.18), formatted input/outputfunctions (7.19.6), formatted wide character input/output functions (7.24.2).7.8.1 Macros for format specifiers1Each of the following object-like macros191) expands to a character string literalcontaining a conversion specifier, possibly modified by a length modifier, suitable for usewithin the format argument of a formatted input/output function when converting thecorresponding integer type.

These macro names have the general form of PRI (characterstring literals for the fprintf and fwprintf family) or SCN (character string literalsfor the fscanf and fwscanf family),192) followed by the conversion specifier,followed by a name corresponding to a similar type name in 7.18.1. In these names, Nrepresents the width of the type as described in 7.18.1. For example, PRIdFAST32 canbe used in a format string to print the value of an integer of type int_fast32_t.2The fprintf macros for signed integers are:PRIdNPRIiNPRIdLEASTNPRIiLEASTNPRIdFASTNPRIiFASTNPRIdMAXPRIiMAXPRIdPTRPRIiPTR190) See ‘‘future library directions’’ (7.26.4).191) C++ implementations should define these macros only when _ _STDC_FORMAT_MACROS is definedbefore <inttypes.h> is included.192) Separate macros are given for use with fprintf and fscanf functions because, in the general case,different format specifiers may be required for fprintf and fscanf, even when the type is thesame.198Library§7.8.1WG14/N12563PRIoLEASTNPRIuLEASTNPRIxLEASTNPRIXLEASTNPRIoFASTNPRIuFASTNPRIxFASTNPRIXFASTNPRIoMAXPRIuMAXPRIxMAXPRIXMAXPRIoPTRPRIuPTRPRIxPTRPRIXPTRSCNdMAXSCNiMAXSCNdPTRSCNiPTRSCNoMAXSCNuMAXSCNxMAXSCNoPTRSCNuPTRSCNxPTRThe fscanf macros for signed integers are:SCNdNSCNiN5ISO/IEC 9899:TC3The fprintf macros for unsigned integers are:PRIoNPRIuNPRIxNPRIXN4Committee Draft — Septermber 7, 2007SCNdLEASTNSCNiLEASTNSCNdFASTNSCNiFASTNThe fscanf macros for unsigned integers are:SCNoNSCNuNSCNxNSCNoLEASTNSCNuLEASTNSCNxLEASTNSCNoFASTNSCNuFASTNSCNxFASTN6For each type that the implementation provides in <stdint.h>, the correspondingfprintf macros shall be defined and the corresponding fscanf macros shall bedefined unless the implementation does not have a suitable fscanf length modifier forthe type.7EXAMPLE#include <inttypes.h>#include <wchar.h>int main(void){uintmax_t i = UINTMAX_MAX;// this type always existswprintf(L"The largest integer value is %020"PRIxMAX "\n", i);return 0;}7.8.2 Functions for greatest-width integer types7.8.2.1 The imaxabs functionSynopsis1#include <inttypes.h>intmax_t imaxabs(intmax_t j);Description2The imaxabs function computes the absolute value of an integer j.

If the result cannotbe represented, the behavior is undefined.193)193) The absolute value of the most negative number cannot be represented in two’s complement.§7.8.2.1Library199ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Returns3The imaxabs function returns the absolute value.7.8.2.2 The imaxdiv functionSynopsis1#include <inttypes.h>imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);Description2The imaxdiv function computes numer / denom and numer % denom in a singleoperation.Returns3The imaxdiv function returns a structure of type imaxdiv_t comprising both thequotient and the remainder. The structure shall contain (in either order) the membersquot (the quotient) and rem (the remainder), each of which has type intmax_t.

Ifeither part of the result cannot be represented, the behavior is undefined.7.8.2.3 The strtoimax and strtoumax functionsSynopsis1#include <inttypes.h>intmax_t strtoimax(const char * restrict nptr,char ** restrict endptr, int base);uintmax_t strtoumax(const char * restrict nptr,char ** restrict endptr, int base);Description2The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,strtoul, and strtoull functions, except that the initial portion of the string isconverted to intmax_t and uintmax_t representation, respectively.Returns3The strtoimax and strtoumax functions return the converted value, if any.

If noconversion could be performed, zero is returned. If the correct value is outside the rangeof representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned(according to the return type and sign of the value, if any), and the value of the macroERANGE is stored in errno.Forward references: the strtol, strtoll, strtoul, and strtoull functions(7.20.1.4).200Library§7.8.2.3WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.8.2.4 The wcstoimax and wcstoumax functionsSynopsis1#include <stddef.h>// for wchar_t#include <inttypes.h>intmax_t wcstoimax(const wchar_t * restrict nptr,wchar_t ** restrict endptr, int base);uintmax_t wcstoumax(const wchar_t * restrict nptr,wchar_t ** restrict endptr, int base);Description2The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,wcstoul, and wcstoull functions except that the initial portion of the wide string isconverted to intmax_t and uintmax_t representation, respectively.Returns3The wcstoimax function returns the converted value, if any.

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

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

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

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