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

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

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

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

If the subjectsequence D has the decimal form and more than DECIMAL_DIG significant digits,consider the two bounding, adjacent decimal strings L and U, both havingDECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L ≤ D ≤ U.The result should be one of the (equal or adjacent) values that would be obtained bycorrectly rounding L and U according to the current rounding direction, with the extra258) It is unspecified whether a minus-signed sequence is converted to a negative number directly or bynegating the value resulting from converting the corresponding unsigned sequence (see F.5); the twomethods may yield different results if rounding is toward positive or negative infinity.

In either case,the functions honor the sign of zero if floating-point arithmetic supports signed zeros.259) An implementation may use the n-char sequence to determine extra information to be represented inthe NaN’s significand.§7.20.1.3Library309ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256stipulation that the error with respect to D should have a correct sign for the currentrounding direction.260)Returns10The functions return the converted value, if any. If no conversion could be performed,zero is returned. If the correct value is outside the range of representable values, plus orminus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the returntype and sign of the value), and the value of the macro ERANGE is stored in errno.

Ifthe result underflows (7.12.1), the functions return a value whose magnitude is no greaterthan the smallest normalized positive number in the return type; whether errno acquiresthe value ERANGE is implementation-defined.7.20.1.4 The strtol, strtoll, strtoul, and strtoull functionsSynopsis1#include <stdlib.h>long int strtol(const char * restrict nptr,char ** restrict endptr,int base);long long int strtoll(const char * restrict nptr,char ** restrict endptr,int base);unsigned long int strtoul(const char * restrict nptr,char ** restrict endptr,int base);unsigned long long int strtoull(const char * restrict nptr,char ** restrict endptr,int base);Description2The strtol, strtoll, strtoul, and strtoull functions convert the initialportion of the string pointed to by nptr to long int, long long int, unsignedlong int, and unsigned long long int representation, respectively.

First,they decompose the input string into three parts: an initial, possibly empty, sequence ofwhite-space characters (as specified by the isspace function), a subject sequence260) DECIMAL_DIG, defined in <float.h>, should be sufficiently large that L and U will usually roundto the same internal floating value, but if not will round to adjacent values.310Library§7.20.1.4WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3resembling an integer represented in some radix determined by the value of base, and afinal string of one or more unrecognized characters, including the terminating nullcharacter of the input string.

Then, they attempt to convert the subject sequence to aninteger, and return the result.3If the value of base is zero, the expected form of the subject sequence is that of aninteger constant as described in 6.4.4.1, optionally preceded by a plus or minus sign, butnot including an integer suffix.

If the value of base is between 2 and 36 (inclusive), theexpected form of the subject sequence is a sequence of letters and digits representing aninteger with the radix specified by base, optionally preceded by a plus or minus sign,but not including an integer suffix. The letters from a (or A) through z (or Z) areascribed the values 10 through 35; only letters and digits whose ascribed values are lessthan that of base are permitted. If the value of base is 16, the characters 0x or 0X mayoptionally precede the sequence of letters and digits, following the sign if present.4The subject sequence is defined as the longest initial subsequence of the input string,starting with the first non-white-space character, that is of the expected form.

The subjectsequence contains no characters if the input string is empty or consists entirely of whitespace, or if the first non-white-space character is other than a sign or a permissible letteror digit.5If the subject sequence has the expected form and the value of base is zero, the sequenceof characters starting with the first digit is interpreted as an integer constant according tothe rules of 6.4.4.1. If the subject sequence has the expected form and the value of baseis between 2 and 36, it is used as the base for conversion, ascribing to each letter its valueas given above.

If the subject sequence begins with a minus sign, the value resulting fromthe conversion is negated (in the return type). A pointer to the final string is stored in theobject pointed to by endptr, provided that endptr is not a null pointer.6In other than the "C" locale, additional locale-specific subject sequence forms may beaccepted.7If the subject sequence is empty or does not have the expected form, no conversion isperformed; the value of nptr is stored in the object pointed to by endptr, providedthat endptr is not a null pointer.Returns8The strtol, strtoll, strtoul, and strtoull functions return the convertedvalue, if any.

If no conversion could be performed, zero is returned. If the correct valueis outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return typeand sign of the value, if any), and the value of the macro ERANGE is stored in errno.§7.20.1.4Library311ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.20.2 Pseudo-random sequence generation functions7.20.2.1 The rand functionSynopsis1#include <stdlib.h>int rand(void);Description2The rand function computes a sequence of pseudo-random integers in the range 0 toRAND_MAX.3The implementation shall behave as if no library function calls the rand function.Returns4The rand function returns a pseudo-random integer.Environmental limits5The value of the RAND_MAX macro shall be at least 32767.7.20.2.2 The srand functionSynopsis1#include <stdlib.h>void srand(unsigned int seed);Description2The srand function uses the argument as a seed for a new sequence of pseudo-randomnumbers to be returned by subsequent calls to rand.

If srand is then called with thesame seed value, the sequence of pseudo-random numbers shall be repeated. If rand iscalled before any calls to srand have been made, the same sequence shall be generatedas when srand is first called with a seed value of 1.3The implementation shall behave as if no library function calls the srand function.Returns4The srand function returns no value.5EXAMPLEThe following functions define a portable implementation of rand and srand.static unsigned long int next = 1;int rand(void)// RAND_MAX assumed to be 32767{next = next * 1103515245 + 12345;return (unsigned int)(next/65536) % 32768;}312Library§7.20.2.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3void srand(unsigned int seed){next = seed;}7.20.3 Memory management functions1The order and contiguity of storage allocated by successive calls to the calloc,malloc, and realloc functions is unspecified.

The pointer returned if the allocationsucceeds is suitably aligned so that it may be assigned to a pointer to any type of objectand then used to access such an object or an array of such objects in the space allocated(until the space is explicitly deallocated). The lifetime of an allocated object extendsfrom the allocation until the deallocation. Each such allocation shall yield a pointer to anobject disjoint from any other object. The pointer returned points to the start (lowest byteaddress) of the allocated space.

If the space cannot be allocated, a null pointer isreturned. If the size of the space requested is zero, the behavior is implementationdefined: either a null pointer is returned, or the behavior is as if the size were somenonzero value, except that the returned pointer shall not be used to access an object.7.20.3.1 The calloc functionSynopsis1#include <stdlib.h>void *calloc(size_t nmemb, size_t size);Description2The calloc function allocates space for an array of nmemb objects, each of whose sizeis size.

The space is initialized to all bits zero.261)Returns3The calloc function returns either a null pointer or a pointer to the allocated space.7.20.3.2 The free functionSynopsis1#include <stdlib.h>void free(void *ptr);Description2The free function causes the space pointed to by ptr to be deallocated, that is, madeavailable for further allocation. If ptr is a null pointer, no action occurs. Otherwise, ifthe argument does not match a pointer earlier returned by the calloc, malloc, or261) Note that this need not be the same as the representation of floating-point zero or a null pointerconstant.§7.20.3.2Library313ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256realloc function, or if the space has been deallocated by a call to free or realloc,the behavior is undefined.Returns3The free function returns no value.7.20.3.3 The malloc functionSynopsis1#include <stdlib.h>void *malloc(size_t size);Description2The malloc function allocates space for an object whose size is specified by size andwhose value is indeterminate.Returns3The malloc function returns either a null pointer or a pointer to the allocated space.7.20.3.4 The realloc functionSynopsis1#include <stdlib.h>void *realloc(void *ptr, size_t size);Description2The realloc function deallocates the old object pointed to by ptr and returns apointer to a new object that has the size specified by size.

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

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

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

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