Java Reference
In-Depth Information
max = 2 + 1023 *
1.1111111111111111111111111111111111111111111111111111
= 1.7976931348623157E308
Denormalized
exponent = -1022
min = 2 -1022 *
0.0000000000000000000000000000000000000000000000000001
= 4.9E 324
max = 2 -1022 *
0.1111111111111111111111111111111111111111111111111111
= 2.225073858507201E 308
A.3.2 Special values
As discussed in Chapter 2, operations with floating-point never result in an excep-
tion thrown. (Exceptions are Java error conditions. See Section 3.9.) For example,
even if an operation results in a divide by zero there is no exception thrown. (An
integer divided by zero does throw an exception.)
Instead of error messages for abnormal operations, the floating-point result is
filled with one of several special floating-point values (see code in Section 2.12.2):
Floating-point special values:
Float.POSITIVE - INFINITY :overflow of a positive value
Float.NEGATIVE - INFINITY :overflow of a negative value
Float.NaN - Not - a-Number : zero divided by zero, square root of 1
Positive zero : underflow from positive direction, e.g.
10
Negative zero : underflow from negative direction, e.g.
x = 2.0e
45 * 1.0e
x = -2.0e 45*1.0e 10
Finite floating-point numbers and the special values are ordered from smallest to largest
as follows:
1. NEGATIVE - INFINITY
2. Negative finite values
3. Negative zero and Positive zero
4. Positive finite values
5. POSITIVE - INFINITY
The positive and negative zero values act as follows:
Positive zero and negative zero compare as equal
1.0/( positive zero ) POSITIVE - INFINITY
1.0/( negative zero ) NEGATIVE - INFINITY
Search WWH ::




Custom Search