Java Reference
In-Depth Information
Appendix 3
Java floating-point
Floating point values in Java are represented by two types:
float
and
double
.
Java follows most of the standard IEEE 754 floating-point specifications but not
all. In Chapter 2 we discussed floating-point and here we provide some additional
information.
A.3.1 Minimum/maximum values
Table 2.3 gave the bit allocations for the two floating-point types and Section
2.11.2 described the values that can be taken for the exponents and significands.
Below we show the minimum and maximum values in binary and decimal rep-
resentations for the two types for both the normalized and denormalized cases.
A.3.1.1
float
Normalized
-126
≤
exponent
≤
+127
min = 2
-126
* 1.00000000000000000000000 = 1.17549435E
−
38
max = 2
+
127
* 1.11111111111111111111111 = 3.4028235E38
Denormalized
exponent = -126
min = 2
-126
* 0.00000000000000000000001 = 1.4012985E
−
45
max
=
2
-126
* 0.11111111111111111111111
=
1.1754942E
−
38
A.3.1.2
double
Normalized
-1022
≤
exponent
≤
+1023
min
=
2
-1022
*
1.0000000000000000000000000000000000000000000000000000
=
2.2250738585072014E
−
308
693
Search WWH ::
Custom Search