Can someone explain how floating point numbers are stored in C, as for 32-bit float, 1 bit is parity, 23 bits for mantissa and 8 bits for exponent. So for numbers greater than 2^23(still in the float range), there is no space in the mantissa to store them.

1 Answer 1


The 23 bits in the mantissa determine the precision of the number. The 8 bits in the exponent determine the range of the number.

Consider the same problem in decimal terms. To keep it simple, let's say you're allowed a mantissa that's a positive number with 6 decimal digits of precision, and a number from -20 to 20 as the exponent. That means you would be able to store numbers in the range of




(give or take a few zeroes)

The mantissa varies from 1 to 999999. The exponent determines where the decimal point goes.

  • 2
    I feel like this answer would be improved if you had a "therefore..." section. something along the lines of "therefore, a 32-bit float stores numbers greater than 2^23 with limited precision, meaning some integers above that range can't be represented exactly." Commented Apr 12, 2019 at 4:38
  • A 32 bit float also stores numbers less than 2^23 with limited precision.
    – gnasher729
    Commented Apr 12, 2019 at 6:40
  • @user1118321 the discussion of FP and float versus double combined with topics like "when is == not really ==" and "what the heck is this EPSILON thing" is a full page essay all on its own. Commented Apr 12, 2019 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.