[issue10061] ** operator yielding wrong result for negative numbers

2010-10-10 Thread Raymond Hettinger
Raymond Hettinger 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

[issue10061] ** operator yielding wrong result for negative numbers

2010-10-09 Thread Senthil Kumaran
Senthil Kumaran added the comment: It's to do with operator precedence. ** takes higher precedence than negative. http://docs.python.org/reference/expressions.html#Summary (-5) ** 4 will give what you are looking for. -- nosy: +orsenthil resolution: -> invalid stage: -> committed/r

[issue10061] ** operator yielding wrong result for negative numbers

2010-10-09 Thread eswar s
New submission from eswar s : -5 ** 4 results as -625. It should be 625 -- components: None messages: 118311 nosy: eswar.s priority: normal severity: normal status: open title: ** operator yielding wrong result for negative numbers type: compile error versions: Python 2.6 __