Java Reference
In-Depth Information
Figure 3-7. Storing the number 13 in 2's complement forms
Binary Representation of Floating-Point Numbers
Any binary floating-point system can represent only a finite number of floating-point values in exact form. All other
values must be approximated by the closest representable value. The IEEE 754-1985 is the most widely accepted
floating-point standard in the computer industry, and it specifies the format and the method to represent binary
floating-point numbers. The goal of the IEEE standard, which is designed for engineering calculations, is to maximize
accuracy (to get as close as possible to the actual number). Precision refers to the number of digits that you can
represent. The IEEE standard attempts to balance the number of bits dedicated to the exponent with the number of
bits used for the fractional part of the number, to keep both accuracy and precision within acceptable limits. This
section describes IEEE 754-1985 standard for binary floating-point format in general and points out how Java supports
this standard.
A floating-point number has four parts:
Sign
Significand (also known as mantissa)
Base (also known as radix)
Exponent
The floating-point number 19.25 can be represented with all its four parts as
+19.25 x 10 0
Here, the sign is + (positive), the significand is 19.25, the base is 10, and the exponent is 0.
The number 19.25 can also be represented in many other forms, as shown below. I will omit the positive sign of
the number, that is, +19.25 will be written as 19.25.
19.25 x 10 0
1.925 x 10 1
0.1925 x 10 2
192.5 x 10 -1
1925 x 10 -2
Therefore, a floating-point number can be represented an infinite number of ways. A floating-point number
represented in base 10 is said to be in normalized form if its significand satisfies the following rule:
0.1 <= significand < 1
 
Search WWH ::




Custom Search