Issue 8353: Negative exponentiation behaving oddly in python shell (original) (raw)
When using exponentiation interactively in the python shell, it returns all negative results when a negative number is the input. For example:
-4 ** 2 will return -16 -4 ** 2 should evaluate as -4 * -4, which correctly returns 16
This does not occur when using the 'Run Module' feature of IDLE and the exponentiation is processed from the module, it only seems to occur when directly typed into the interactive prompt. I couldn't find anything to suggest this is expected behavior. Using pow() from the prompt returns the correct result, so it only happens in this one situation. Obviously this is low priority since it only affects the prompt and there's a working alternative, but I figured I'd report it anyways. :)