# Why the greatest exponent that can be represented in single-precision floating-pointer numbers is 127 (and not 128)?

I was told by a class mate that the smallest exponent that we can represent by a single-precision floating-point number (which uses 8 bits for the exponent) is $-126$ and the greatest is $127$.

I know that exponents are represented using excess or bias notation, that is, we represent all exponents, including the negative ones, using positive binary numbers, which we obtain by summing to the real exponent (which can be negative) the bias. In the single-precision floating-point system, the bias is $2^{\text{# of bits in exponent - 1}} - 1$, which in our case is $2^{8 - 1} - 1 = 2^7 - 1 = 128 - 1 = 127$.

To obtain the decimal exponent from the biased one, we can subtract $-127$.

Now, since $0$ has a special representation in this system, the first biased exponent is $1$, so $1 - 127 = -126$.

But I don't understand why the greatest exponent isn't $128$, since, again, the first biased exponent would be $1$.

What am I missing?

Exponent $-127$ is reserved for representing zero and denormal numbers, and the exponent $+128$ is reserved for representing infinities and NaNs, as described here: https://en.wikipedia.org/wiki/Single-precision_floating-point_format#Exponent_encoding
So for normalized numbers, the exponent range is $[-126,127]$.
• Actually I think I do not understand this excess notation and how it works under the hood. From your answer and my current intuition it seems similar to two's complement, but two's complement has one more negative number than a positive one, excluding zero, and excess is the reversed, i.e. it has one less negative number than positive. So, the original range in excess is actually $[-127, 128]$, but then we shorten the range because we want to reserve some combinations for special numbers ($0$, infinity, etc)... – nbro Apr 8 '16 at 15:32
• My doubt was more about, if the smallest representable exponent in this system is $1_{10}$, then in excess notation, the largest number should be $127 + 1 = 128$ (because we always sum 127 to the decimal exponent that we want to represent) and the smallest, as you're saying is $1 - 127 = -126$. In other words, if we want to represent the exponent $1_{10}$ in this notation, we can't (doing $1 + 127$) because the range has been shortened to up $127$...What am I missing? – nbro Apr 8 '16 at 15:32