Q-5) (a) The following numbers use the IEEE 32-bit floating-point format.
What is the
equivalent decimal value? i) 1 10000011 11000000000000000000000 ii) 0 01111110
10100000000000000000000 (b) Convert the following decimal number to IEEE 32-bit
floating-point format i) -16.625 X 10 ^ (-4) ii) -3013.3125
Ans. (a) (i) Sign bit is 1 so, the value is negative.
Exponent = 100000112
Decimal value of 100000112 = 13110
Exponent adjusted = 131 – (28-1 – 1) = 4
Normalized form = 1.11000000000000000000000 2 x 24
Mantissa = 11000000000000000000000 2
Decimal value of mantissa = (1*2-1) + (1*2-2) = 0.7510
According to the formula, (-1)sign x (1 + Mantissa) x 2(Exponent adjusted)
= (-1)1 x (1 + 0.75) x 24
= -1.75 x 24
= -28
(ii) Sign bit is 0 so, the value is positive.
Exponent = 011111102
Decimal value of 011111102 = 12610
Exponent adjusted = 126 – (28-1 – 1) = -1
Normalized form = 1.10100000000000000000000 2 x 2-1
Mantissa = 10100000000000000000000 2
Decimal value of mantissa = (1*2-1) + (1*2-3) = 0.625
According to the formula, (-1)sign x (1 + Mantissa) x 2(Exponent adjusted)
= (-1)0 x (1 + 0.625) x 2-1
= 1.625 x 2-1
= 0.8125
(b) (i) -16.625x10-4
= -1.6625x10-3
= -1.6625x2-10
Binary of 0.662510 = 0.10101001100110011012
Normalized form = 1.1010100110011001101 2 x 2-10
Mantissa = 1010100110011001101
Exponent = (-10) + (28-1 – 1) = 117
Binary of exponent = 011101012
Since the value is negative so, sign bit is 1
Therefore, the final number is:
Sign Exponent Mantissa
1 01110101 10101001100110011010000
(ii) -3013.3125
Binary of 301310 = 1011110001012
Binary of 0.3125:
0.3125 x 2 = 0.625 0 Generate 0 and continue.
0.625 x 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 x 2 = 0.5 0 Generate 0 and continue.
0.5 x 2 = 1.0 1 Generate 1 and nothing remains.
Binary of 3013.312510 is = 101111000101.01012
Normalized form = 1.0111100010101012 x 211
Mantissa = 011110001010101
Exponent = 11 + (28-1 – 1) = 138.
Binary of exponent = 100010102
Since the value is negative so, sign bit is 1
Therefore, the final number is:
Sign Exponent Mantissa
1 10001010 01111000101010100000000