Why can floating point store more values than integers?

748 views

In a 32-bit floating point, it was said that the highest possible value is 3.4028235 x 10^38. However, when we evaluate this, it will be equal to 340282346638528860000000000000000000000. This whole number would require more than 100 integer bits right? My question is: If that is the case, how come this number requiring more than 100 bits fitted in a 32-bit floating point?

In: 3

23 Answers

Anonymous 0 Comments

A given number of bits can represent the same number of numbers. The range these numbers can take can vary depending upon how you use those bits, but the total number of numbers you can represent is still 2^32. While floating point represents a larger range of number than integers of the same bits, the number of floating point numbers that can be represented are exactly the same (2^32).

You sacrifice precision of your numbers when you use some of the bits to indicate exponents. You can express every integer between the lower and upper bound (least and greatest representable number) of 32-bit integers. With floating point numbers you cannot represent every integer between the lower and upper bound of representation.

You are viewing 1 out of 23 answers, click here to view all answers.