Computer Arithmetic
What is the hexadecimal bit pattern of decimal 1.0 in IEEE 754 single precision?
- A0x00000001
- B0x3F000000
- C0x3F800000
Show answer and explanation
Answer: C. 0x3F800000
1.0 = 1.0 × 2⁰, so the sign is 0, the true exponent is 0 and the stored exponent is 0 + 127 = 127 = 0111 1111, and the significand (excluding the leading 1) is all zeros. Laid out, that is 0 01111111 000…0; grouping by four bits gives 0011 1111 1000 0000 …, or 0x3F800000. 0x00000001 is the integer 1's bit pattern, which as a float is a tiny subnormal. 0x3F000000 has a stored exponent of 126 and represents 0.5.
- A. 0x00000001 is the integer 1; as a float it is a subnormal.
- B. 0x3F000000 has exponent field 126 and represents 0.5.
- C. Correct. Sign 0, exponent 127, significand 0 gives 0x3F800000.