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
- A. II, III and IV only
- B. I, II and IV only
- C. II only
- 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
- A hypothetical 8-bit floating-point format follows IEEE 754 conventions: 1 sign bit, 4 exponent bits (bias 7), 3 fraction bits, with…
- An 8-bit floating-point format follows IEEE 754 conventions: 1 sign bit, 4 exponent bits (bias 7; field 15 reserved for ∞/NaN), 3 fraction…
- A floating-point format has a sign bit and 3 fraction bits (so 4 significant bits including the hidden 1), with round-to-nearest…
- A binary floating-point format keeps 4 significant bits (1 hidden + 3 stored fraction bits) with a wide exponent range and…
- For an 8-bit signed integer x (−128 to 127), x >> 2 is an arithmetic right shift (sign bit replicated) and x / 4 is division truncated…
- Over all 256 eight-bit patterns x (with −x and x − 1 computed modulo 2⁸), for how many is x & (−x) equal to x ^ (x − 1), where & is…