Computer Arithmetic

Under IEEE 754, what result does the standard specify for dividing a positive number by zero?

  1. A0
  2. BThe largest normal number
  3. CPositive infinity
Show answer and explanation

Answer: C. Positive infinity

IEEE 754 specifies that dividing a nonzero number by zero returns positive or negative infinity according to the signs. Infinity is encoded with an all-ones exponent and a zero significand and is also the result of overflow. Computation can continue without stopping, and anomalies can be found by inspecting results later. 0 ÷ 0, which has no defined value, gives NaN. Unlike integer division, floating point does not trap by default.

  • A. The result is not 0.
  • B. It is infinity, not the largest normal number.
  • C. Correct. A positive number ÷ 0 is positive infinity.
Practice this topic Back to topic

More Computer Arithmetic questions

  1. When x is NaN, what does evaluating x == x give in most programming languages?
  2. In IEEE 754 single precision, what do bit patterns with an all-ones exponent field (255) represent?
  3. Which correctly describes +0 and −0 in IEEE 754 floating point?
  4. Which rounding method does IEEE 754 specify as the default?
  5. Rounding to integers with round half to even, what do 2.5 and 3.5 become?