Binary floating-point literals

A real binary floating-point constant consists of the following:

Both the integral and fractional parts are made up of decimal digits. You can omit either the integral part or the fractional part, but not both. You can omit either the decimal point or the exponent part, but not both.

Read syntax diagramSkip visual syntax diagramBinary floating-point literal syntax
 
     .-----------.     .-------.
     V           |     V       |
>>-+---+-------+-+--.----digit-+--+--------------+-+--+---+----><
   |   '-digit-'                  '-| exponent |-' |  +-f-+
   | .-------.                                     |  +-F-+
   | V       |                                     |  +-l-+
   +---digit-+--.--+--------------+----------------+  '-L-'
   |               '-| exponent |-'                |
   | .-------.                                     |
   | V       |                                     |
   '---digit-+--| exponent |-----------------------'
 
Exponent:
 
                  .-------.
                  V       |
|--+-e-+--+----+----digit-+-------------------------------------|
   '-E-'  +-+--+
          '- --'
 

The suffix f or F indicates a type of float, and the suffix l or L indicates a type of long double. If a suffix is not specified, the floating-point constant has a type double.

A plus (+) or minus (-) symbol can precede a floating-point literal. However, it is not part of the literal; it is interpreted as a unary operator.

The following are examples of floating-point literals:

Floating-point constant Value
5.3876e4 53,876
4e-11 0.00000000004
1e+5 100000
7.321E-3 0.007321
3.2E+4 32000
0.5e-6 0.0000005
0.45 0.45
6.e10 60000000000

Related information



[ Top of Page | Previous Page | Next Page | Contents | Index ]