Go to the first, previous, next, last section, table of contents.


4.13.2 Floating Constants

Larch/C++ floating constants are the same as C++ floating numbers (see Section 2.5.3 of [Ellis-Stroustrup90]).

floating-constant   ::= fractional-constant [exponent-part] [float-suffix]
                   | digit [ digit ] ... exponent-part [float-suffix]
fractional-constant ::= [ digit ] ... . digit [ digit ] ...
                   | digit [ digit ] ... .
exponent-part     ::= exponent-indicator [ sign ] digit [ digit ] ...
exponent-indicator  ::= e | E
sign                ::= - | +
float-suffix        ::= f | F | l | L

Some examples of floating-constant follow.

123.456
.123
123.
1234.456e-7
12345E7
1234.456e+7F
1234eE7L

A floating-constant has sort double, unless the type is explicitly specified by a suffix. The suffixes f and F mean float while the suffixes l and L mean long double.


Go to the first, previous, next, last section, table of contents.