GATE Computer ScienceHardGATE CS (PYQ pattern)

Which of the following are true? (Python-style double precision for I, III, IV; single precision rounding for II.) I. adding 0.1 to a total initialised at 0.0 ten times (a loop) gives exactly 1.0 II. when the double sum 0.1 + 0.2 is rounded to single precision it equals the single-precision rounding of 0.3 III. 0.1 × 10 == 1.0 IV. 0.1 + 0.2 == 0.3

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

Correct answer: C. II and III only

Repeated addition accumulates rounding errors and ends at 0.9999999999999999 (I false). 0.1 × 10 rounds to exactly 1.0 (III true). In double, 0.1 + 0.2 = 0.30000000000000004 ≠ 0.3 (IV false), but after rounding to single precision both sides are 0x3E99999A (II true).

More Digital Logic questions

Exams that ask this topic