0

## Binary Fractions and Floating Point

• Expressing binary fractions in the floating-point format may also be done using the same method we have developed above. We shall illustrate the technique by using a numerical example.

Example 34: Express decimal fraction ¼ in the binary floating-point format.

Solution: As the first step, we convert the given decimal fraction into regular binary fraction. The conversion yields

1/4 = 0.25 = 0. 010

Now, since the given number is a fraction, we employ the reverse of our previous technique, i.e., first multiply and then divide (instead of first dividing and then multiplying) for its floating-point representation. Also, since there are only two bits in the given fraction 0.01 (the 0 after the 1 is not counted), it seems quite natural that we use 22 for multiplying and dividing it. However, we have imposed a restriction on the mantissa M that for binary floating-point format it should lie in between ½ and 1. Imposition of this restriction means that we have to express the mantissa as 0.1, and not as 0.01. This further means that we have to multiply and divide the number by 21, and not by 22. Performing this operation yields

X = (0.01 x 21)(1/21) = 0.1 x 2-1

Now, the exponent of X, which is a negative integer, must also be expressed in binary,as stated above. Carrying out this exercise, our floating-point representation of decimal fraction ¼ becomes

X = (0.01 x 21)(1/21) = 0.1 x 21001

where the first 1 in the exponent represents the negative sign, and the next three bits, viz. 001, represent decimal 1.