1. Check out our companion app, Forums for Android! Download from Google Play

Support Calculator Bug/Fail

Discussion in 'Android Devices' started by Eivindo110, Apr 16, 2013.

  1. Eivindo110

    Eivindo110 New Member
    Thread Starter
    5

    Apr 16, 2013
    1
    0
    5
    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 :)
     

    Advertisement

  2. AntimonyER

    AntimonyER AF Addict
    1,343

    Jun 18, 2010
    13,646
    8,004
    1,343
    Statesboro, GA
    It's an order of operations thing. Put parenthesis Round the -2 to get the correct response. It's taking the power first, then applying the negative.
     
    GuitarG20, Hadron and El Presidente like this.
  3. Hadron

    Hadron  
    VIP Member
    2,218

    Aug 9, 2010
    19,116
    12,097
    2,218
    Spacecorp Test Pilot
    Dimension Jumping
    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. :)
     
    GuitarG20 and El Presidente like this.
Tags:

Share This Page

Loading...