Computer Arithmetic
Under IEEE 754, what result does the standard specify for dividing a positive number by zero?
- A0
- BThe largest normal number
- 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.