Java Reference
In-Depth Information
0l 0777L 0x100000000L 2_147_483_648L 0xC0B0L
3.10.2. Floating-Point Literals
A floating-point literal has the following parts: a whole-number part, a decimal or hexa-
decimal point (represented by an ASCII period character), a fraction part, an exponent, and
a type suffix.
A floating-point literal may be expressed in decimal (base 10) or hexadecimal (base 16).
For decimal floating-point literals, at least one digit (in either the whole number or the frac-
tion part) and either a decimal point, an exponent, or a float type suffix are required. All
other parts are optional. The exponent, if present, is indicated by the ASCII letter e or E
followed by an optionally signed integer.
For hexadecimal floating-point literals, at least one digit is required (in either the whole
number or the fraction part), and the exponent is mandatory, and the float type suffix is
optional. The exponent is indicated by the ASCII letter p or P followed by an optionally
signed integer.
Underscores are allowed as separators between digits that denote the whole-number part,
and between digits that denote the fraction part, and between digits that denote the expo-
nent.
FloatingPointLiteral:
DecimalFloatingPointLiteral
HexadecimalFloatingPointLiteral
DecimalFloatingPointLiteral:
Digits . Digits opt ExponentPart opt FloatTypeSuffix opt
. Digits ExponentPart opt FloatTypeSuffix opt
Digits ExponentPart FloatTypeSuffix opt
Digits ExponentPart opt FloatTypeSuffix
ExponentPart:
ExponentIndicator SignedInteger
ExponentIndicator: one of
e E
SignedInteger:
Sign opt Digits
Sign: one of
+ -
FloatTypeSuffix: one of
Search WWH ::




Custom Search