TYPES, VALUES, AND VARIABLES
Floating Point Types and Values
4.2.3
second multiplication is a
long
multiplication. The value
727379968
is the deci
mal value of the low 32 bits of the mathematical result,
1000000000000
, which is
a value too large for type
int
.
Any value of any integral type may be cast to or from any numeric type. There
are no casts between integral types and the type
boolean
.
4.2.3 Floating Point Types and Values
The floating point types are
float
and
double
, representing the single precision
32 bit and double precision 64 bit format IEEE 754 values and operations as
specified in
IEEE Standard for Binary Floating Point Arithmetic
, ANSI/IEEE
Standard 754 1985 (IEEE, New York).
The IEEE 754 standard includes not only positive and negative sign magni
tude numbers, but also positive and negative zeros, positive and negative
infinities
,
and a special
Not a Number
(hereafter abbreviated NaN). The NaN value is used
to represent the result of certain operations such as dividing zero by zero. NaN
constants of both
float
and
double
type are predefined as
Float.NaN
( 20.9.5)
and
Double.NaN
( 20.10.5).
The finite nonzero values of type
float
are of the form
s m
2
e
, where
s
is
+1 or 1,
m
is a positive integer less than 2
24
, and
e
is an integer between 149
and 104, inclusive. Values of that form such that
m
is positive but less than 2
23
and
e
is equal to 149 are said to be
denormalized
.
The finite nonzero values of type
double
are of the form
s m
2
e
, where
s
is
+1 or 1,
m
is a positive integer less than 2 , and
53
e
is an integer between 1075
and 970, inclusive. Values of that form such that
m
is positive but less than
52
2
and
e
is equal to 1075 are said to be
denormalized
.
Except for NaN, floating point values are
ordered
; arranged from smallest to
largest, they are negative infinity, negative finite nonzero values, negative zero,
positive zero, positive finite nonzero values, and positive infinity.
Positive zero and negative zero compare equal; thus the result of the expres
sion
0.0== 0.0
is
true
and the result of
0.0> 0.0
is
false
. But other opera
tions can distinguish positive and negative zero; for example,
1.0/0.0
has the
value positive infinity, while the value of
1.0/ 0.0
is negative infinity. The oper
ations
Math.min
and
Math.max
also distinguish positive zero and negative zero.
NaN is
unordered
, so the numerical comparison operators
<
,
<=
,
>
, and
>=
return
false
if either or both operands are NaN ( 15.19.1). The equality operator
==
returns
false
if either operand is NaN, and the inequality operator
!=
returns
true
if either operand is NaN ( 15.20.1). In particular,
x!=x
is
true
if and only if
x
is NaN, and
(x=y)
will be
false
if
x
or
y
is NaN.
Any value of a floating point type may be cast to or from any numeric type.
There are no casts between floating point types and the type
boolean
.
33
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