Why do floating point values have infinity?

Why do floating point values have infinity instead of just a higher exponent?

• Assuming we want the floating point number to fit in a set amount of space (which we may not, but this is certainly the case for floating point implemented in hardware), what do you propose to happen when we go beyond the highest exponent? Oct 21 '17 at 22:58
• Because it is more useful than any other number that can be added? Oct 22 '17 at 2:37

But even assuming such a model, we aren't really addressing the core of the issue. Let's say that at a certain point we ask the machine to perform the computation $\log(0)$. Mathematically, it doesn't make any sense, because $\log$ isn't defined on $0$. If we didn't have a special value like -INF to return, we would have to abort the computation (or have the program diverge, or terminate in some kind of error state). You might think that such a thing is reasonable: after all, if we had the machine compute $\log(0)$ the program must be wrong in a way or another.
But it gets worse. In any floating point model, there is a smallest positive number that we can distinguish from zero, let that number be $\varepsilon$. Now, we ask the machine to compute $\delta = e^{-10}\varepsilon$ and then $\log(\delta)$. Observe that all those operations are mathematically legit, for instance we can easily see that $\log(\delta) = \log(\varepsilon)-10$. However $\delta < \varepsilon$, which means that our model literally cannot tell $\delta$ and $0$ apart, by definition of $\varepsilon$. It is much less reasonable to make the entire program fail, now.