GATE CS 2024 Set 2 | Question 14

MCQ · 1 mark · −0.33

The format of a single-precision floating-point number as per the IEEE 754 standard is:

Sign
(1bit)
Exponent
(8 bits)
Mantissa
(23 bits)

Choose the largest floating-point number among the following options.

  1. Option A:
    SignExponentMantissa
    00111 11111111 1111 1111 1111 1111 111
  2. Option B:
    SignExponentMantissa
    01111 11101111 1111 1111 1111 1111 111
    (correct)
  3. Option C:
    SignExponentMantissa
    01111 11111111 1111 1111 1111 1111 111
  4. Option D:
    SignExponentMantissa
    00111 11110000 0000 0000 0000 0000 000

Answer

(B)

Explanation

All four have sign bit 0, so compare their values using the exponent bias of 127.

  • A: exponent 0111 1111 is 127, so the value is \((2 - 2^{-23}) \times 2^{0}\), just under 2.
  • B: exponent 1111 1110 is 254, so the value is \((2 - 2^{-23}) \times 2^{127}\), about \(3.4 \times 10^{38}\).
  • C: an all-ones exponent is reserved. With a non-zero mantissa the pattern means NaN (not a number), which has no value to compare.
  • D: exponent 127 with a zero mantissa is exactly 1.

B is in fact the largest finite single-precision number, so it is the largest option.

Answer: B