GATE Computer ScienceHardGATE CS (PYQ pattern)
A floating-point format has a sign bit and 3 fraction bits (so 4 significant bits including the hidden 1), with round-to-nearest, ties-to-even, and a wide exponent. Evaluate (9 + 0.25) + 0.25 and 9 + (0.25 + 0.25).
- A. 9 and 9
- B. 9 and 10
- C. 10 and 10
- D. 9.5 and 9.5
Correct answer: B. 9 and 10
Numbers in [8, 16) have spacing 1. 9.25 rounds to 9, and 9 + 0.25 rounds to 9 again. But 0.25 + 0.25 = 0.5 is exact and 9.5 is a tie between 9 and 10: ties-to-even selects 10 (mantissa 010).
More Digital Logic questions
- 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…
- An 8-bit two's complement adder computes 3x as (x + x) + x for every x from −128 to 127, setting the overflow flag V separately on each…
- Over all 256 eight-bit patterns, for how many does the value read as sign-magnitude equal the value read as two's complement?
- Over all 256 eight-bit patterns, for how many does the value read as sign-magnitude, as one's complement and as two's complement all…