GATE Computer ScienceHardGATE CS (PYQ pattern)
In C with IEEE 754 single-precision float, let x = 16777216.0f (2²⁴). What are the values of (x + 1.0f) + 1.0f and x + (1.0f + 1.0f)?
- A. 16777218 and 16777218
- B. 16777216 and 16777216
- C. 16777216 and 16777218
- D. 16777217 and 16777218
Correct answer: C. 16777216 and 16777218
Above 2²⁴ the spacing between floats is 2. x + 1 is a tie and rounds to even, which is x again; adding 1 once more gives x again. But 1 + 1 = 2 is exact, and x + 2 = 16777218 is representable. Floating point addition is not associative.
More Digital Logic questions
- How many IEEE 754 single-precision numbers x satisfy 1 ≤ x < 1000?
- How many of the 2³² IEEE 754 single-precision bit patterns represent a finite value that is an integer (both zeros included, both signs…
- What is the smallest positive integer N such that N + 0.5 is NOT exactly representable in IEEE 754 single precision?
- Which of the following comparisons evaluate to true when done in IEEE 754 double-precision arithmetic (round to nearest even)? I. 0.1 +…
- 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…