Computer Arithmetic

Which rounding method does IEEE 754 specify as the default?

  1. ARound to the nearest value, and on a tie round to the even side
  2. BAlways truncate toward zero
  3. CAlways round up toward the larger value
Show answer and explanation

Answer: A. Round to the nearest value, and on a tie round to the even side

The IEEE 754 default is round half to even: round to the nearest representable value, and on an exact tie choose the one whose last bit is 0 (even). Always rounding ties up biases errors in one direction, accumulating drift over many operations, whereas rounding to even splits ties evenly so they cancel. Rounding toward zero or toward positive infinity are also in the standard but are selected for special purposes such as interval arithmetic, not the default.

  • A. Correct. Round half to even is the default.
  • B. Rounding toward zero is in the standard but is not the default.
  • C. Rounding toward positive infinity is not the default either.
Practice this topic Back to topic

More Computer Arithmetic questions

  1. Rounding to integers with round half to even, what do 2.5 and 3.5 become?
  2. What is the phenomenon called in which subtracting two nearly equal floating-point numbers greatly reduces the significant digits?
  3. For very large x, computing √(x + 1) − √x in floating point suffers catastrophic cancellation. Which rewrite computes it accurately?
  4. In single precision, adding 1 to 100 million (10⁸) leaves the result unchanged at 100 million. Which explains this?
  5. What is the purpose of Kahan (compensated) summation when adding many floating-point numbers?