floating point literal
来自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. |
浮点文字定义了编译时间常数,其值在源文件中指定.
Original:
Floating point literal defines a compile-time constant whose value is specified in the source file.
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.
[编辑] 语法
浮点文字有两种语法。第一个由以下几部分组成:1
Original:
A floating-point literals have two syntaxes. The first one 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.
You can help to correct and verify the translation. Click here for instructions.
- 非空序列包含小数点的字符定义了显著的小数位数Original:nonempty sequence of decimal digits containing a decimal point character (defines significant)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. - (可选的)后缀类型说明符作为一个
l,f,L或FOriginal:(可选的) a suffix type specifier as al,f,LorFThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
第二个由以下几部分组成:1
Original:
The second one 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.
You can help to correct and verify the translation. Click here for instructions.
- 非空序列的小数位数(定义见显著)Original:nonempty sequence of decimal digits (defines significant)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. - (可选的)后缀类型说明符作为一个
l,f,L或FOriginal:(可选的) a suffix type specifier as al,f,LorFThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
后缀类型说明符定义浮点文字的实际类型
Original:
The suffix type specifier defines the actual type of the floating-point literal:
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.
- (没有后缀)定义doubleOriginal:(no suffix) defines doubleThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
f F定义floatOriginal:f Fdefines floatThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
l L定义long doubleOriginal:l Ldefines long doubleThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
[编辑] 解释
一个十进制科学记数法,这意味着指数为功率10的显著multiplied.
的的
的的
Original:
A decimal scientific notation is used, meaning that the exponent is the power of 10 by which the significant is multiplied.
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.
在数学上的意义123e4是“123×10 4 </ SUP>”</div>
Original:
The mathematical meaning of 123e4 is 123×104
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::cout << 123.456e-67 << '\n' << .1E4f << '\n' << 58. << '\n' << 4e2 << '\n';
Output:
1.23456e-65 1000 58 400