Computer Arithmetic

Converting −6.25 to single precision, what is the sign–exponent–significand bit string written in hexadecimal?

  1. A0xC0C80000
  2. B0x40C80000
  3. C0xC0A80000
Show answer and explanation

Answer: A. 0xC0C80000

6.25 in binary is 110.01, normalized as 1.1001 × 2². The sign is negative, so 1; the stored exponent is 2 + 127 = 129 = 1000 0001; and the significand is the fraction 1001 followed by zeros. Laid out, 1 10000001 1001000…0 groups into 1100 0000 1100 1000 0000 …, which is 0xC0C80000. 0x40C80000 has sign bit 0 and represents +6.25, and 0xC0A80000 has significand 0101 and represents −5.25.

  • A. Correct. Sign 1, exponent 129, significand 1001 gives 0xC0C80000.
  • B. 0x40C80000 has sign 0 and is +6.25.
  • C. 0xC0A80000 has a different significand and is −5.25.
Practice this topic Back to topic

More Computer Arithmetic questions

  1. Which correctly describes representing decimal 0.1 as a binary floating-point number?
  2. In many programming languages, why is the double-precision comparison 0.1 + 0.2 == 0.3 false?
  3. What is the machine epsilon (the gap between 1 and the next larger representable number) in IEEE 754 single precision?
  4. Which gives the approximate number of reliable decimal digits for single and double precision?
  5. What is the role of IEEE 754 subnormal numbers?