by **howardleeharkness** » Wed Oct 30, 2013 5:12 pm

Thank you for the prompt response. I was a bit surprised by the answer, but at least I now have a workaround for this "feature." I just have to remember to always enclose negative numbers in parens. Although pow(-5,2) works just as well as pow((-5),2), and -5 * -5 gives the same answer as (-5) * (-5).

I was surprised about the need for parens on a calculator. I haven't used a pocket calculator in over a decade, but I started ages ago on HP/RPN calculators, which did not require paren entry. I see that the Windows calculator wants to enter the parens for you. Plus, Windows calculator doesn't appear to have an exponentiation operator that you can enter via the keyboard, although you can use the appropriately-labeled button (which will square -5 correctly even when entered sans parens).

However, I did find a calculator which requires parens to get the right answer for (-5)^2 -- it's the one on my Android smartphone. Just never ran into that before.