Java Reference
In-Depth Information
In a normalized form, the significand can use all its storage bits to store significant digits (bits).
For example, if you allocate only five bits to store the significand, for the number 0.0010110 x 2 10
only 0.00101 part of the significand will be stored. However, if you normalize this number as
1.0110 x 2 7 , the significand can be stored fully in five bits.
In a normalized form, the significand always starts with a 1 bit, which can be omitted while
storing the significand. When reading back, you can add the leading 1 bit. This omitted bit is
called the “hidden bit” and it provides one extra bit of precision.
The IEEE 754 -1985 standard defines the four floating-point formats as follows:
32-bit single-precision floating-point format
64-bit double-precision floating-point format
Single-extended floating-point format
Java uses IEEE 32-bit single-precision floating-point format to store the values of float data type. It uses 64-bit
double-precision floating-point format to store the values of double data type.
I will discuss only IEEE 32-bit single-precision floating-point format. The difference between single-precision
floating-point format and other formats are the total number of bits used to store the binary floating-point numbers
and the distribution of number of bits among sign, exponent, and significand. The difference among different IEEE
formats will be shown at the end of the discussion.
Double-extended floating-point format
32-bit Single-Precision Floating-Point Format
The 32-bit single-precision floating-point format uses 32 bits to store a binary floating-point number. A binary
floating-point number is of the following form:
Sign * Significand * 2 Exponent
Since the base is always 2, this format does not store the value of the base. The 32 bits are distributed as follows:
1 bit to store the sign
8 bits to store the exponent
23 bits to store the significand
The layout for the single-precision floating-point format is shown in Table 3-6 .
Table 3-6. IEEE Single-Precision Format Layout
1-bit Sign
8-bit Exponent
23-bit Significand
s
eeeeeeee
fffffffffffffffffffffff
Sign
IEEE single-precision floating-point format uses 1 bit to store the sign of the number. A 0 sign bit indicates a positive
number and 1 sign bit indicates a negative number.
 
Search WWH ::




Custom Search