Computer Arithmetic
Up to what value can IEEE 754 single precision represent every integer exactly, starting from 0?
- A2²³ = 8388608
- B2²⁴ = 16777216
- 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.