std::atof
来自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. |
| Defined in header <cstdlib>
|
||
| double atof( const char *str ); |
||
解釋浮點值一個位元組的字元串所指向的
str.Original:
Interprets an 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可選的負號或加號和非空的十進制數字序列(DEFINES指數)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可選的負號或加號和非空的十六進制數字序列(DEFINES指數)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」只能包含字母數字字元。其結果是一個安靜的南浮點值.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 | - | null結尾的位元組串的指針進行解釋
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. |
[编辑] 返回值
double的值對應於成功
str的內容。如果轉換的值落在範圍的返回類型,返回值是不確定的。如果沒有可以進行轉換,0.0返回.Original:
double value corresponding to the contents of
str on success. If the converted value falls out of range of the return type, the return value is undefined. If no conversion can be performed, 0.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.
[编辑] 為例
| 本節是不完整的 原因: no example |
[编辑] 另請參閱
| 一個位元組的字元串轉換為浮點值 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 documentation for atof
| |