[Python-Dev] Symmetry arguments for API expansion (original) (raw)

Tim Peters tim.peters at gmail.com
Mon Mar 12 20:06:16 EDT 2018


[Tim Peters]

... >>> (-math.inf) ** 3.1 inf

[David Mertz]

Weird. I take it that's what IEEE-754 says. NaN would sure be more intuitive here since inf+inf-j is not in the domain of Reals. Well, technically neither is inf, but at least it's the limit of the domain. :-).

Mathematical reals have all sorts of properties floats fail to capture, while mathematical reals don't distinguish between -0 and +0 at all. "Practical' symmetry arguments often underlie what float standards require. At heart , the rules for infinite arguments are often consequences of "more obvious" rules for signed zero arguments, following from replacing +-inf with 1/+-0 in the latter.

More explanation here:

https://stackoverflow.com/questions/10367011/why-is-pow-infinity-positive-non-integer-infinity

But we're not required to like it; we just have to implement it ;-)

>>> (-math.inf) ** 3.0 # NOTE THIS ONE -inf >>> (-math.inf) ** 2.9 inf



More information about the Python-Dev mailing list