std::strtof, std::strtod, std::strtold
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Заголовочный файл <cstdlib>
|
||
| float strtof( const char* str, char** str_end ); |
(начиная с C++11) | |
| double strtod( const char* str, char** str_end ); |
||
| long double strtold( const char* str, char** str_end ); |
(начиная с C++11) | |
Интерпретирует значение с плавающей точкой в строку байт, на который указывает
str.Original:
Interprets a floating point value in a byte string pointed to by
str.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Функция удаляет все пробельные символы (как определено std::isspace()), пока первый не-символу найдено. Затем он берет столько символов, сколько возможно, чтобы сформировать правильное представление с плавающей точкой и преобразует их в значение с плавающей точкой. Допустимые значения с плавающей точкой может быть одним из следующих способов:
Original:
Function discards any whitespace characters (as determined by std::isspace()) until first non-whitespace character is found. Then it takes as many characters as possible to form a valid floating point representation and converts them to floating point value. The valid floating point value can be one of the following:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- десятичных чисел с плавающей точкой выражение. Он состоит из следующих частей:Original:decimal floating point expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (необязательно) знаком плюс или минусOriginal:(необязательно) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - непустая последовательность десятичных цифр, необязательно содержащую символ десятичной точки (определяет мантиссы)Original:nonempty sequence of decimal digits optionally containing a decimal point character (defines significand)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (необязательно)
eилиEзатем с дополнительным минусом или плюсом и непустая последовательность десятичных цифр (определяет показатель степени)Original:(необязательно)eorEfollowed with optional minus or plus sign and nonempty sequence of decimal digits (defines exponent)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- двоичных чисел с плавающей точкой выражение. Он состоит из следующих частей:Original:binary floating point expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (необязательно) знаком плюс или минусOriginal:(необязательно) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
0xor0X - непустая последовательность шестнадцатеричных цифр, необязательно содержащую символ десятичной точки (определяет мантиссы)Original:nonempty sequence of hexadecimal digits optionally containing a decimal point character (defines significand)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (необязательно)
pилиPзатем с дополнительным минусом или плюсом и непустая последовательность шестнадцатеричных цифр (определяет показатель степени)Original:(необязательно)porPfollowed with optional minus or plus sign and nonempty sequence of hexadecimal digits (defines exponent)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- бесконечности выражения. Он состоит из следующих частей:Original:infinity expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (необязательно) знаком плюс или минусOriginal:(необязательно) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
INFилиINFINITYбез учета регистраOriginal:INForINFINITYignoring caseThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- Не-число выражения. Он состоит из следующих частей:Original:not-a-number expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (необязательно) знаком плюс или минусOriginal:(необязательно) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
NANилиNAN(' char_sequence)игнорируя случаеNANчасти. ' Char_sequence может содержать только буквенно-цифровые символы. В результате тихой NaN значение с плавающей точкой.Original:NANorNAN(char_sequence)ignoring case of theNANpart. char_sequence can only contain alphanumeric characters. The result is a quiet NaN floating point value.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
Функции устанавливает указатель на которую указывает
str_end чтобы она указывала на символ после последнего символа интерпретируются. Если str_end является NULL, он игнорируется.Original:
The functions sets the pointer pointed to by
str_end to point to the character past the last character interpreted. If str_end is NULL, it is ignored.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Содержание |
[править] Параметры
| str | - | указатель с нулевым байтом строки должны интерпретироваться
Original: pointer to the null-terminated byte string to be interpreted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| str_end | - | Указатель на указатель на символ .
Original: pointer to a pointer to character. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[править] Возвращаемое значение
С плавающей точкой значения, соответствующего содержания
str на успех. Если преобразованное значение выпадает из диапазона соответствующий тип возвращения, диапазон ошибки и HUGE_VAL, HUGE_VALF или HUGE_VALL возвращается. Если преобразование не может быть выполнено, 0 возвращается.Original:
Floating point value corresponding to the contents of
str on success. If the converted value falls out of range of corresponding return type, range error occurs and HUGE_VAL, HUGE_VALF or HUGE_VALL is returned. If no conversion can be performed, 0 is returned.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] Пример
| Этот раздел не завершён Причина: нет примера |
[править] См. также
| преобразует байт строки в значение с плавающей точкой Original: converts a byte string to a floating point value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
| C документация для strtof, strtod, strtold
| |