Computer Arithmetic

Up to what value can IEEE 754 single precision represent every integer exactly, starting from 0?

  1. A2²³ = 8388608
  2. B2²⁴ = 16777216
  3. C2³¹ = 2147483648
Show answer and explanation

Answer: B. 2²⁴ = 16777216

The single-precision significand has 24 bits of precision including the hidden bit, so every integer up to 2²⁴ = 16777216 is exact. Beyond that the spacing becomes 2, and 16777217 cannot be represented and rounds to 16777216; a single-precision counter stops increasing there. 2²³ forgets the hidden bit, and 2³¹ confuses it with the 32-bit integer range. Double precision is exact up to 2⁵³.

  • A. 2²³ forgets to count the hidden bit.
  • B. Correct. With 24 bits of precision, integers up to 2²⁴ are exact.
  • C. 2³¹ confuses it with the 32-bit integer range.
Practice this topic Back to topic

More Computer Arithmetic questions

  1. Why are monetary amounts often handled as integers in the smallest unit (one yen or one cent) rather than as binary floating point?
  2. In mixed-precision AI training, why are master weights kept in FP32 while most computation is done in FP16 or bfloat16?
  3. In unsigned fixed point with the low 4 of 8 bits as the fraction, what value does the bit pattern 0011 1000 represent?
  4. Which three parts make up an IEEE 754 floating-point number?
  5. How are the bits of an IEEE 754 single-precision (32-bit) number allocated among sign, exponent and significand?