# What are the biggest and smallest represent-able numbers with single precision floating points?

I am trying to understand the limits of the floating point representation.

On a 32-bit computer with 7 bits for the exponent and 24 bits for the mantissa, I want to know the biggest and smallest numbers.

My calculation:

Base 2

Biggest positive number = $$+ 1 \times 2^{127}$$

Smallest positive number = $$+ 2^{-24} \times 2^{-127}$$

Biggest negative number = $$- 2^{-24} \times 2^{-127}$$

Smallest negative number = $$-1 \times 2^{127}$$

Decimal

Biggest positive number = $$+1 \times 10^{38}$$

Smallest positive number= $$+ 10^{-7} \times 10^{-38}$$

Biggest negative number= $$- 10^{-7} \times 10^{-38}$$

Smallest negative number = $$-1 \times 10^{38}$$

Is this a correct calculation?

## 2 Answers

Your implementation varies a bit from the IEEE standard, but the Wikipedia page gives explicit calculations for binary. There are details about the offset in the exponent and whether the leading 1 is suppressed in the mantissa that need to be considered before you get a final answer. But their range is about 1.18 E-38 to 3.4 E38 and with one bit less in the exponent you should have a range of about 1.18 E-19 to 3.4 E19.

For the base 10 case you need to specify how the base 10 numbers are stored for a clean answer. Added: it looks like your base 10 numbers are approximately the decimal equivalents of the binary. I hadn't noticed and thought you were storing values somehow in base 10.

All current CPUs store floating point in binary, therefore you can get the decimal ranges by mere base conversion. I don't know what is your background, but keep in mind that there is loss of precision when numbers with different exponents are involved in an operation, see epsilon.

• More to the point: in inexact arithmetic, there exist representable numbers $\eta$ such that $x+\eta=x$ for any $x$, and for $x=1$, machine $\epsilon$ is the largest such $\eta$. Jul 17, 2011 at 15:42
• The OP has given a calculation that shows that he clearly understands that. He wants to know if his results are correct.
– user13618
Jul 30, 2011 at 17:53
• He's give results in decimal separately; which indicated to me he did not understand how numbers are stored in computers. Jul 30, 2011 at 17:57