Go Back   Android Forums > Android Phones > HTC One X/XL

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
LinkBack Thread Tools
Old April 16th, 2013, 03:03 PM   #1 (permalink)
New Member
Thread Author (OP)
Join Date: Apr 2013
Posts: 1
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation 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

Eivindo110 is offline  
Reply With Quote
sponsored links
Old April 16th, 2013, 03:48 PM   #2 (permalink)
AF Addict
AntimonyER's Avatar
Join Date: Jun 2010
Location: Statesboro, GA
Posts: 13,546
Device(s): Droid DNA, Nexus 7 16GB
Carrier: Verizon

Thanks: 5,016
Thanked 9,309 Times in 4,999 Posts

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.
Site Rules & Guidelines
Got some help? Hit Thanks!
See something you like? Hit Like!
See something you hate? Hit Report!
AntimonyER is offline  
Reply With Quote
The Following 3 Users Say Thank You to AntimonyER For This Useful Post:
El Presidente (April 16th, 2013), GuitarG20 (April 16th, 2013), Hadron (April 16th, 2013)
Old April 16th, 2013, 04:11 PM   #3 (permalink)
AF Contributor
Hadron's Avatar
Join Date: Aug 2010
Location: Dimension Jumping
Posts: 11,528
Device(s): HTC One (S-Off), HTC Desire (retired)
Carrier: Orange UK

Thanks: 2,150
Thanked 4,770 Times in 3,466 Posts

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.
Forum Rules & Guidelines - Android Forums FAQ
If a post helps you, use the Thanks! button.
Spam or offensive? Don't respond, report it /!\
Hadron is offline  
Reply With Quote
The Following 2 Users Say Thank You to Hadron For This Useful Post:
El Presidente (April 16th, 2013), GuitarG20 (April 16th, 2013)

Current Rating:
Rate this Phone:

The HTC One X is the first quad-core Android smartphone, not only by HTC but from any manufacturer. It'll have a Tegra 3 chipset inside by NVIDIA alongside 1GB of RAM, an 8 megapixel HD camera with flash, front-facing camera, a 4.7 inch 720p di... Read More

bug, calculator, calculator bug, calculator fail, fail, math, numbers, squared

Go Back   Android Forums > Android Phones > HTC One X/XL

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -5. The time now is 12:23 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.