Machine-translated by Google. Questions are authored in English.
Top

Discussion

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.

  • A.0 0111 1111 1111 1111 1111 1111 1111 111
  • B.0 1111 1110 1111 1111 1111 1111 1111 111
  • C.0 1111 1111 1111 1111 1111 1111 1111 111
  • D.0 0111 1111 0000 0000 0000 0000 0000 000

Answer: B

The largest number is 0 1111 1110 1111 1111 1111 1111 1111 111.

All four have sign bit 0, so they are positive, and a larger exponent field gives a larger number. The exponent 1111 1111 is reserved: with a non-zero mantissa it encodes NaN (not a number), so the third pattern is not a number at all and cannot be the largest.

The largest usable exponent is 1111 1110 (254, an actual exponent of 127), and with an all-ones mantissa this pattern is the largest finite single-precision value, about \(3.4 \times 10^{38}\).

The first and fourth patterns have exponent 0111 1111 (127, an actual exponent of 0), giving values just under 2 and exactly 1.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.