• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Calculator Bug/Fail

When typing -2^2 on the built in calculator on my HTC One X, it gives me the answer -4. And that is wrong... The correct answer is +4. To get that you need to type -2*-2

It happends when typing in a negative number and rais it with an even number.

WRONG: -4^6=-4096
CORRECT: -4*-4*-4*-4*-4*-4=4096

Hope it helped :)
 
I had trouble reproducing this!

That was because to square -2 I automatically enter "2", then toggle the sign, then apply the power. So I have "-2" which I then raise to the desired power, and if this gave a negative answer for an even power it would certainly be a bug.

However, if I just press the keys "minus" "two" "squared" then it does indeed return -4. But that is, as Anti says, is just following the rules of operator precedence. You start with "0" on the screen, so if you enter that sequence of key presses you are actually entering the sum "0 - 2^2", for which the correct answer is "-4".

No, it's fine. :)
 
Back
Top Bottom