### 2 词法约定 【词法】

#### 2.13.3 浮点文字量 【词法.浮点常量】

floating-literal:
fractional-constant exponent-partopt floating-suffixopt
digit-sequence exponent-part floating-suffixopt

fractional-constant:
digit-sequenceopt . digit-sequence
digit-sequence .

exponent-part:
e signopt digit-sequence
E signopt digit-sequence

sign: one of
+ -

digit-sequence:
digit
digit-sequence digit

floating-suffix: one of
f l F L

浮点-文字量:
小数-常量 指数-部分opt 浮点-后缀opt
数字-序列 指数-部分 浮点-后缀opt

小数-常量:
数字-序列opt . 数字-序列
数字-序列 .

指数-部分:
e 符号opt 数字-序列
E 符号opt 数字-序列

符号: 下列之一
+ -

数字-序列:
数字
数字-序列 数字

浮点-后缀: 下列之一
f l F L

A floating literal consists of an integer part, a decimal point, a fraction part, an e or E, an optionally signed integer exponent, and an optional type suffix. The integer and fraction parts both consist of a sequence of decimal (base ten) digits. Either the integer part or the fraction part (not both) can be omitted; either the decimal point or the letter e (or E) and the exponent (not both) can be omitted. The integer part, the optional decimal point and the optional fraction part form the significant part of the floating literal. The exponent, if present, indicates the power of 10 by which the significant part is to be scaled. If the scaled value is in the range of representable values for its type, the result is the scaled value if representable, else the larger or smaller representable value nearest the scaled value, chosen in an implementation-defined manner. The type of a floating literal is double unless explicitly specified by a suffix. The suffixes f and F specify float, the suffixes l and L specify long double. If the scaled value is not in the range of representable values for its type, the program is ill-formed.

PREV [lex.ccon] | NEXT [lex.string] 上一页 【词法.字符常量】 | 下一页 【词法.字符串】

0 0