Gate CSE 2021 Previous Year Questions (Floating Point Representation )
Questions Consider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127.
S: 1 E: 10000001 F : 11110000000000000000000
Here S, E and F denote the sign, exponent and fraction components of the floating point representation.
The decimal value corresponding to the above representation (rounded to 2 decimal places) is ______
Solution
To convert the given IEEE 754 single-precision floating-point representation to its decimal value, we’ll follow these steps:
- Identify the Components:
- Sign (S): 1 (indicating a negative number)
- Exponent (E): 10000001 (binary)
- Fraction (F): 11110000000000000000000 (binary)
- Convert the Exponent (E) to Decimal:
- The exponent is stored with a bias of 127. First, convert the binary exponent to decimal:100000012=\(1×2^7+0×2^6+0×2^5+0×2^4+0×2^3+0×2^2+0×2^1+1×2^0=129_{10}\)
- Subtract the bias to get the actual exponent:Actual Exponent=\(129−127=2\)
- Convert the Fraction (F) to Decimal:
- The fraction part represents the binary digits after the decimal point. Convert it to a decimal fraction:\(11110000000000000000000_2=1×2^{−1}+1×2{−2}+1×2{−3}+1×2{−4}+0×2{−5}+\)\(=0.5+0.25+0.125+0.0625=0.9375\)
- Add the implicit leading 1 (as per IEEE 754 standard):
Mantissa=\(1+0.9375=1.9375\)
- Calculate the Decimal Value:
- Combine the sign, mantissa, and exponent:
Value=\((−1)^S×Mantissa×2^{Actual Exponent Value}\)
\(=(−1)^1×1.9375×2^2=−1.9375×4=−7.75\)
- Combine the sign, mantissa, and exponent:
- Final Answer:
- The decimal value corresponding to the given IEEE 754 representation is:−7.75