[issue32171] Inconsistent results for fractional power of -infinity

Tim Peters report at bugs.python.org
Wed Nov 29 16:45:32 EST 2017


Tim Peters <tim at python.org> added the comment:

As a comment in the referenced patch says, the intent of the patch was to make behavior match the C99 spec.  Among other things, C99's annex F (section F.9.4.4 "The pow functions") says:

"""
— pow(−∞, y) returns −0 for y an odd integer < 0.
— pow(−∞, y) returns +0 for y < 0 and not an odd integer.
— pow(−∞, y) returns −∞ for y an odd integer > 0.
— pow(−∞, y) returns +∞ for y > 0 and not an odd integer.
"""

So the case you show is doing what the standard specifies, under the last of those (y=0.5, which is > 0 and not an odd integer).

----------
nosy: +tim.peters

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32171>
_______________________________________


More information about the Python-bugs-list mailing list