[issue29016] negative numbers raised to power zero should be 1, not -1

Tim Peters report at bugs.python.org
Mon Dec 19 12:51:57 EST 2016


New submission from Tim Peters:

They already are.

>>> (-2)**0
1

You're probably doing this instead:

>>> -2**0
-1

Exponentiation has higher precedence than unary minus, so that last example groups as -(2**0), and -1 is correct.

----------
nosy: +tim.peters
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29016>
_______________________________________


More information about the Python-bugs-list mailing list