Floating-Point Examples (Cont.)

Question: What is the decimal value of this double-precision floating-point number?

1 0 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Answer:            

Example IV
Show the IEEE 754 binary representation of the number -6.8125 in single and double precision.

Answer: Fraction bits can be obtained by repeatedly multiplying each fraction by 2 and collecting the integer until the fractional part is 0:
   0.8125 × 2 = 1.625 ⇒ 1
   0.6250 × 2 = 1.250 ⇒ 1
   0.2500 × 2 = 0.500 ⇒ 0
   0.5000 × 2 = 1.000 ⇒ 1
So the binary strings of the fraction and number are as follows:
    0.8125 = 13/16 = ½ + ¼ + 1/16 = 0.11012
   -6.8125 = -110.11012 = -1.1011012×22
The exponent (single precision)  = 2 + Bias = 2 +  127 =  129 and
The exponent (double precision) = 2 + Bias = 2 + 1023 = 1025.

Therefore, the single-precision representation of -6.8125 is as follows:

1 1 0 0 0 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

and the double-precision representation of -6.8125 is as follows:

1 1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0




      “As a well spent day brings happy sleep, so life well used brings happy death.”    
      ― Leonardo da Vinci