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

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

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

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

The value is rounded tothe appropriate number of digits.A double argument representing an infinity is converted in one of the styles[-]inf or [-]infinity — which style is implementation-defined. Adouble argument representing a NaN is converted in one of the styles[-]nan or [-]nan(n-char-sequence) — which style, and the meaning ofany n-char-sequence, is implementation-defined. The F conversion specifierproduces INF, INFINITY, or NAN instead of inf, infinity, or nan,respectively.243)e,EA double argument representing a floating-point number is converted in thestyle [−]d.ddd e±dd, where there is one digit (which is nonzero if theargument is nonzero) before the decimal-point character and the number ofdigits after it is equal to the precision; if the precision is missing, it is taken as6; if the precision is zero and the # flag is not specified, no decimal-pointcharacter appears.

The value is rounded to the appropriate number of digits.The E conversion specifier produces a number with E instead of eintroducing the exponent. The exponent always contains at least two digits,and only as many more digits as necessary to represent the exponent. If thevalue is zero, the exponent is zero.A double argument representing an infinity or NaN is converted in the styleof an f or F conversion specifier.g,GA double argument representing a floating-point number is converted instyle f or e (or in style F or E in the case of a G conversion specifier),depending on the value converted and the precision. Let P equal theprecision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.Then, if a conversion with style E would have an exponent of X :— if P > X ≥ −4, the conversion is with style f (or F) and precisionP − (X + 1).— otherwise, the conversion is with style e (or E) and precision P − 1.Finally, unless the # flag is used, any trailing zeros are removed from the243) When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;the # and 0 flag characters have no effect.278Library§7.19.6.1WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3fractional portion of the result and the decimal-point character is removed ifthere is no fractional portion remaining.A double argument representing an infinity or NaN is converted in the styleof an f or F conversion specifier.a,AA double argument representing a floating-point number is converted in thestyle [−]0xh.hhhh p±d, where there is one hexadecimal digit (which isnonzero if the argument is a normalized floating-point number and isotherwise unspecified) before the decimal-point character244) and the numberof hexadecimal digits after it is equal to the precision; if the precision ismissing and FLT_RADIX is a power of 2, then the precision is sufficient foran exact representation of the value; if the precision is missing andFLT_RADIX is not a power of 2, then the precision is sufficient todistinguish245) values of type double, except that trailing zeros may beomitted; if the precision is zero and the # flag is not specified, no decimalpoint character appears.

The letters abcdef are used for a conversion andthe letters ABCDEF for A conversion. The A conversion specifier produces anumber with X and P instead of x and p. The exponent always contains atleast one digit, and only as many more digits as necessary to represent thedecimal exponent of 2. If the value is zero, the exponent is zero.A double argument representing an infinity or NaN is converted in the styleof an f or F conversion specifier.cIf no l length modifier is present, the int argument is converted to anunsigned char, and the resulting character is written.If an l length modifier is present, the wint_t argument is converted as if byan ls conversion specification with no precision and an argument that pointsto the initial element of a two-element array of wchar_t, the first elementcontaining the wint_t argument to the lc conversion specification and thesecond a null wide character.sIf no l length modifier is present, the argument shall be a pointer to the initialelement of an array of character type.246) Characters from the array are244) Binary implementations can choose the hexadecimal digit to the left of the decimal-point character sothat subsequent digits align to nibble (4-bit) boundaries.245) The precision p is sufficient to distinguish values of the source type if 16 p−1 > b n where b isFLT_RADIX and n is the number of base-b digits in the significand of the source type.

A smaller pmight suffice depending on the implementation’s scheme for determining the digit to the left of thedecimal-point character.246) No special provisions are made for multibyte characters.§7.19.6.1Library279ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256written up to (but not including) the terminating null character. If theprecision is specified, no more than that many bytes are written. If theprecision is not specified or is greater than the size of the array, the array shallcontain a null character.If an l length modifier is present, the argument shall be a pointer to the initialelement of an array of wchar_t type. Wide characters from the array areconverted to multibyte characters (each as if by a call to the wcrtombfunction, with the conversion state described by an mbstate_t objectinitialized to zero before the first wide character is converted) up to andincluding a terminating null wide character.

The resulting multibytecharacters are written up to (but not including) the terminating null character(byte). If no precision is specified, the array shall contain a null widecharacter. If a precision is specified, no more than that many bytes arewritten (including shift sequences, if any), and the array shall contain a nullwide character if, to equal the multibyte character sequence length given bythe precision, the function would need to access a wide character one past theend of the array. In no case is a partial multibyte character written.247)pThe argument shall be a pointer to void.

The value of the pointer isconverted to a sequence of printing characters, in an implementation-definedmanner.nThe argument shall be a pointer to signed integer into which is written thenumber of characters written to the output stream so far by this call tofprintf. No argument is converted, but one is consumed. If the conversionspecification includes any flags, a field width, or a precision, the behavior isundefined.%A % character is written.

No argument is converted. The completeconversion specification shall be %%.9If a conversion specification is invalid, the behavior is undefined.248) If any argument isnot the correct type for the corresponding conversion specification, the behavior isundefined.10In no case does a nonexistent or small field width cause truncation of a field; if the resultof a conversion is wider than the field width, the field is expanded to contain theconversion result.247) Redundant shift sequences may result if multibyte characters have a state-dependent encoding.248) See ‘‘future library directions’’ (7.26.9).280Library§7.19.6.1WG14/N125611Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly roundedto a hexadecimal floating number with the given precision.Recommended practice12For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactlyrepresentable in the given precision, the result should be one of the two adjacent numbersin hexadecimal floating style with the given precision, with the extra stipulation that theerror should have a correct sign for the current rounding direction.13For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at mostDECIMAL_DIG, then the result should be correctly rounded.249) If the number ofsignificant decimal digits is more than DECIMAL_DIG but the source value is exactlyrepresentable with DECIMAL_DIG digits, then the result should be an exactrepresentation with trailing zeros.

Otherwise, the source value is bounded by twoadjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the valueof the resultant decimal string D should satisfy L ≤ D ≤ U, with the extra stipulation thatthe error should have a correct sign for the current rounding direction.Returns14The fprintf function returns the number of characters transmitted, or a negative valueif an output or encoding error occurred.Environmental limits15The number of characters that can be produced by any single conversion shall be at least4095.16EXAMPLE 1places:To print a date and time in the form ‘‘Sunday, July 3, 10:02’’ followed by π to five decimal#include <math.h>#include <stdio.h>/* ...

*/char *weekday, *month;// pointers to stringsint day, hour, min;fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",weekday, month, day, hour, min);fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));17EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and themembers of the extended character set that consist of more than one byte each consist of exactly two bytes,the first of which is denoted here by a and the second by an uppercase letter.249) For binary-to-decimal conversion, the result format’s values are the numbers representable with thegiven format specifier.

The number of significant digits is determined by the format specifier, and inthe case of fixed-point conversion by the source value as well.§7.19.6.1Library281ISO/IEC 9899:TC318Committee Draft — Septermber 7, 2007WG14/N1256Given the following wide string with length seven,static wchar_t wstr[] = L" X Yabc Z W";the seven callsfprintf(stdout,fprintf(stdout,fprintf(stdout,fprintf(stdout,fprintf(stdout,fprintf(stdout,fprintf(stdout,"|1234567890123|\n");"|%13ls|\n", wstr);"|%-13.9ls|\n", wstr);"|%13.10ls|\n", wstr);"|%13.11ls|\n", wstr);"|%13.15ls|\n", &wstr[2]);"|%13lc|\n", (wint_t) wstr[5]);will print the following seven lines:|1234567890123||X Yabc Z W||| X Yabc Z|X Yabc Z||X Yabc Z W||abc Z W||Z|Forward references: conversion state (7.24.6), the wcrtomb function (7.24.6.3.3).7.19.6.2 The fscanf functionSynopsis1#include <stdio.h>int fscanf(FILE * restrict stream,const char * restrict format, ...);Description2The fscanf function reads input from the stream pointed to by stream, under controlof the string pointed to by format that specifies the admissible input sequences and howthey are to be converted for assignment, using subsequent arguments as pointers to theobjects to receive the converted input.

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

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

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

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