GATE Computer ScienceHardGATE CS

In IEEE 754 single precision (round-to-nearest-even), let a = 2²⁴ = 16777216, b = 1 and c = 1. The two sums S₁ = (a + b) + c and S₂ = a + (b + c) are computed in single precision. What is S₂ − S₁?

  1. A. 4
  2. B. 2
  3. C. 0
  4. D. 1

Correct answer: B. 2

a + b = 2²⁴ + 1 lies exactly half-way between 2²⁴ and 2²⁴ + 2, and ties-to-even rounds back to 2²⁴, so S₁ = 2²⁴ after both additions. Evaluating b + c = 2 first gives S₂ = 2²⁴ + 2 exactly representable. Floating-point addition is not associative.

More Computer Organization and Architecture questions

Exams that ask this topic