On Tue, 15 Sep 2020 at 06:54, David Mertz firstname.lastname@example.org wrote:
Thanks so much Ben for documenting all these examples. I've been frustrated by the inconsistencies, but hasn't realized all of those you note.
It would be a breaking change, but I'd really vastly prefer if almost all of those OverflowErrors and others were simply infinities. That's much closer to the spirit of IEEE-754.
The tricky case is 1./0. Division is such an ordinary operation, and it's so easy to get zero in a variable accidentally. That one still feels like an exception, but yes 1/1e-323 vs. 1/1e-324 would them remain a sore spot.
We need to remember that a significant number of Python users don't have any idea what IEE-754 is, and have never heard of a NaN (and possibly even of infinity as a number). Those people are *far* better served by being told "you made a mistake" in the form of an exception, rather than via a weird numeric value that doesn't work how they expect and doesn't even look like a number when they print it.