[issue10061] ** operator yielding wrong result for negative numbers
Raymond Hettinger
report at bugs.python.org
Sun Oct 10 21:23:43 CEST 2010
Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:
Python's order of operations runs the exponentation before the unary minus. This convention makes the unary minus behave more like the subtraction operator so that: -x**n == 0 - x**n.
This convention is somewhat common but there are exceptions such as MS Excel where the unary minus binds first. See http://en.wikipedia.org/wiki/Order_of_operations#Examples
----------
nosy: +rhettinger
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10061>
_______________________________________
More information about the Python-bugs-list
mailing list