Computer Arithmetic

In IEEE 754 single precision, what do bit patterns with an all-ones exponent field (255) represent?

  1. AThe largest normal number, regardless of the significand
  2. BInfinity if the significand is zero, NaN if it is nonzero
  3. CZero, regardless of the significand
Show answer and explanation

Answer: B. Infinity if the significand is zero, NaN if it is nonzero

The maximum exponent value (all ones) is reserved for special values. With an all-zero significand it represents positive or negative infinity according to the sign bit; with a nonzero significand it represents NaN. NaNs are further subdivided by significand value, for instance into kinds that do or do not signal exceptions. The largest normal number has an exponent field of 254, and zero is the pattern with exponent and significand all zero. An exponent field of 0 represents zero and subnormals.

  • A. The largest normal number has exponent field 254.
  • B. Correct. Zero significand means infinity; nonzero means NaN.
  • C. Zero has an all-zero exponent and significand.
Practice this topic Back to topic

More Computer Arithmetic questions

  1. Which correctly describes +0 and −0 in IEEE 754 floating point?
  2. Which rounding method does IEEE 754 specify as the default?
  3. Rounding to integers with round half to even, what do 2.5 and 3.5 become?
  4. What is the phenomenon called in which subtracting two nearly equal floating-point numbers greatly reduces the significant digits?
  5. For very large x, computing √(x + 1) − √x in floating point suffers catastrophic cancellation. Which rewrite computes it accurately?