On Fri, Sep 11, 2020 at 1:10 PM David Mertz email@example.com wrote:
On Fri, Sep 11, 2020 at 8:58 AM Guido van Rossum firstname.lastname@example.org wrote:
What's wrong with 1e1000?
As a spelling of "infinity" generically, or just as an example of an "arithmetic operation"?
On the latter, I didn't use that just because it feels sort of like a "cheat" rather than an "operation." I.e. my longer example started out with some "reasonable" numbers, but wound up tripping into inf and nan.
Presumably this is all meant to counter Stephen Turnbull's claim:
inf and nan only exist in Python the
language (including builtins) via casting strings to floats (there are
no arithmetic operations that produce them).
While one may argue that writing `1e1000` is not an "arithmetic operation", certainly it's certainly not "casting strings to floats", and it's the simeplest way of producing `inf` in a pinch (in theory it's not portable, but I think "in a pinch" means you don't care about that).
I don't actually understand why Stephen made this claim about arithmetic operations, since inf and nan exist *exactly* because arithmetic operations may produce them. And you don't need to involve pi either, just `1e300 * 1e300` does it.