# C 浮点常量C Floating-Point Constants

“浮点常量”是表示带符号实数的十进制数字。A "floating-point constant" is a decimal number that represents a signed real number. 带符号实数的表现形式包括整数部分、小数部分和指数。The representation of a signed real number includes an integer portion, a fractional portion, and an exponent. 浮点常量用于表示不可更改的浮点值。Use floating-point constants to represent floating-point values that cannot be changed.

## 语法Syntax

floating-point-constantfloating-point-constant:
fractional-constant exponent-partopt floating-suffixopt   fractional-constant exponent-partopt floating-suffixopt
digit-sequence exponent-part floating-suffixopt   digit-sequence exponent-part floating-suffixopt

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

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

sign：一个 sign : one of
+ -   + -

digit-sequencedigit-sequence:
digit   digit
digit-sequence digit   digit-sequence digit

floating-suffix一个 floating-suffix : one of
f l F L   f l F L

``````15.75
1.575E1   /* = 15.75   */
1575e-2   /* = 15.75   */
-2.5e-3   /* = -0.0025 */
25E-4     /* =  0.0025 */
``````

``````100L  /* Has type long double  */
100F  /* Has type float        */
``````

``````.0075e2
0.075e1
.075e1
75e-2
``````