GATE | Gate IT 2008 | Question 7

The following bit pattern represents a floating point number in IEEE 754 single precision format

1 10000011 101000000000000000000000

The value of the number in decimal form is
(A) -10
(B) -13
(C) -26
(D) None of these


Answer: (C)

Explanation:  

To convert the floating point into decimal, we have 3 elements in a 32-bit floating point representation:
i. Sign
ii. Exponent
iii. Mantissa

Sign bit is the first bit of the binary representation. ‘1’ implies negative number and ‘0’ implies positive number Exponent is decided by the next 8 bits of binary representation. 131-127=4
Hence the exponent of 2 will be 4. i.e 2
4=16.
127 is the unique number for 32 bit floating point representation. It is known as bias. It is determined by 2
k-1-1 where ‘k’ is the number of bits in exponent field.
Thus bias = 3 for 8 bit conversion and 127 for 32 bit. (28-1-1 = 128-1=127)
Mantissa is calculated from the remaining 24 bits of the binary representation. It consists of ‘1’ and a fractional part which is determined by:
The fractional part of mantissa is given by:
1*(1/2) + 0*(1/4) + 1*(1/8) + 0*(1/16) +………=0.625
Thus the mantissa will be 1+0.625=1.625
The decimal number hence given as
Sign*Exponent*Mantissa = (-1)*(16)*(1.625) = -26.

Related :
https://www.youtube.com/watch?v=03fhijH6e2w
http://quiz.geeksforgeeks.org/number-representation/

This solution is contributed by Kriti Kushwaha.,


Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.