GATE Computer ScienceHardGATE CS (PYQ pattern)

Which of the following comparisons evaluate to true when done in IEEE 754 double-precision arithmetic (round to nearest even)? I. 0.1 + 0.2 == 0.3 II. 0.75 + 0.125 == 0.875 III. (1e16 + 1.0) − 1e16 == 1.0 IV. 2⁵³ + 1.0 == 2⁵³ V. 0.1 × 3 == 0.3

  1. A. II, III and IV only
  2. B. I, II and IV only
  3. C. II only
  4. D. II and IV only

Correct answer: D. II and IV only

0.75 and 0.125 are dyadic so II is exact. Above 2⁵³ the spacing is 2, so 2⁵³ + 1 rounds back to 2⁵³ (IV true) and 1e16 + 1 rounds back to 1e16, making III false. 0.1 and 0.2 are not exactly representable, so I and V fail.

More Digital Logic questions

Exams that ask this topic