3.10.2
Floating Point Literals
LEXICAL STRUCTURE
3.10.2 Floating Point Literals
See 4.2.3 for a general discussion of the floating point types and values.
A
floating point literal
has the following parts: a whole number part, a deci
mal point (represented by an ASCII period character), a fractional part, an expo
nent, and a type suffix. The exponent, if present, is indicated by the ASCII letter
e
or
E
followed by an optionally signed integer.
At least one digit, in either the whole number or the fraction part, and either a
decimal point, an exponent, or a float type suffix are required. All other parts are
optional.
A floating point literal is of type
float
if it is suffixed with an ASCII letter
F
or
f
; otherwise its type is
double
and it can optionally be suffixed with an ASCII
letter
D
or
d
.
FloatingPointLiteral:
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
f F d D
The Java types
float
and
double
are IEEE 754 32 bit single precision and
64 bit double precision binary floating point values, respectively.
The details of proper input conversion from a Unicode string representation of
a floating point number to the internal IEEE 754 binary floating point representa
tion are described for the methods
valueOf
of class
Float
( 20.9.17) and class
Double
( 20.10.16) of the package
java.lang
.
The largest positive finite
float
literal is
3.40282347e+38f
. The smallest
positive finite nonzero literal of type
float
is
1.40239846e 45f
. The largest
positive finite
double
literal is
1.79769313486231570e+308
. The smallest posi
tive finite nonzero literal of type
double
is
4.94065645841246544e 324
.
22
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved