Computer Arithmetic

What is the hexadecimal bit pattern of decimal 1.0 in IEEE 754 single precision?

  1. A0x00000001
  2. B0x3F000000
  3. 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.
Practice this topic Back to topic

More Computer Arithmetic questions

  1. Converting −6.25 to single precision, what is the sign–exponent–significand bit string written in hexadecimal?
  2. Which correctly describes representing decimal 0.1 as a binary floating-point number?
  3. In many programming languages, why is the double-precision comparison 0.1 + 0.2 == 0.3 false?
  4. What is the machine epsilon (the gap between 1 and the next larger representable number) in IEEE 754 single precision?
  5. Which gives the approximate number of reliable decimal digits for single and double precision?