[issue6781] even exponentiation of negative numbers

2009-08-25 Thread Mark Dickinson
Mark Dickinson added the comment: By the way, I get -1 ^ 2 == -3, not -1: >>> -1 ^ 2 -3 If you're getting -1 instead, then that *is* a bug! Are you? -- ___ Python tracker ___

[issue6781] even exponentiation of negative numbers

2009-08-25 Thread Mark Dickinson
Mark Dickinson added the comment: This is not a bug: -1 ** 2 is parsed as -(1 ** 2), not (-1) ** 2. Take a look at: http://docs.python.org/reference/expressions.html#the-power-operator In -1 ^ 2, ^ is the bitwise exclusive-or operator, not the power operator. pow(x, y) is indeed equivalent

[issue6781] even exponentiation of negative numbers

2009-08-25 Thread benlbroussard
New submission from benlbroussard : Negative one squared should be one, but is negative one sometimes. pow(-1, 2) = 1 -1 ** 2 = -1 -1 ^ 2 = -1 The ** and ^ operators aren't working like expected, and the pow() documentation is incorrect since it says "The two-argument form pow(x, y) is equivale