4.2.3 Example 2

Let us try to represent 0.2 as a single precision floating point number. In order to figure out the binary representation of 0.2 as fractions of powers of 2, we can first multiply a number (a power of 2) to 0.2 so that it has 25 significant binary digits. Note that there is one more digit than what we need for rounding purposes.

The minimum power of 2 to multiply to 0.2 to make it greater than or equal to 1 is 8 because 0.2 23 = 1.6. After that, we multiply the value by 224 to get a 25-bit representation (25 significant digits to the left of the binary point).

0.2 23+24 = 26853545 = 1100110011001100110012. Do you recognize the repeating pattern of 11002? This is because 0.2 cannot be represented by a binary number with a finite number of digits to the right of the binary point! This is much like trying to represent 1
3 in decimal.

At any rate, because the least significant digit is 1, we round up the mantissa as 11001100110011001100110102 227. After normalizing it (right shift 24 times), we end up with the representation of 1.100110011001100110011012 23. The exponent bias is 127, this means the exponent binary pattern needs to represent 127 3 = 124 = 01111100.

As a result, the representation of 0.2 is illustrated in table 3.





signexponent mantissa



0 124 = 01111100210011001100110011001101




Table 3: Representation of 0.2 as a single precision floating point number.