Skip to Content

Apple's tasty calculator mistake


In a recent tip, TUAW reader Dr. Drang told us about a bug he found on the iPhone/iPod touch's calculator. According to his research, when you type π × 2 + 5 = into the calculator you get 11.283... (the correct answer). However, when you reverse the Pi and 2, entering 2 × π + 5, the answer given is 7.

This error can be demonstrated by entering Pi (3.141592654) manually, instead of using the Pi button -- you will get the correct answer each time. Therefore, this error only shows up when you use the Pi button.

So, be sure to read up on this bug from the tipsters website before you use the calculator for anything too important.

Update: Reader Vineet writes in the comments to note that he believes this behavior is typical of stack-based calculators and should be considered more of an operator-expectations issue than a true bug. Dr. Drang responds (with a little bit of attitude) to disagree, maintaining that the behavior is a legitimate bug.

Thanks for the tip, Dr. Drang!

In a recent tip, TUAW reader Dr. Drang told us about a bug he found on the iPhone/iPod touch's calculator. According to his research,...
 

Add a Comment

*0 / 3000 Character Maximum

44 Comments

Filter by:
Seth Amott

If you are using this calculator for your College Calculus class something is wrong. The calculator was designed for not much more than everyday calculations, the fact they added the Scientific version surprised me, i think it was more of a "Look what we can do!" thing than meant to be a legitimate feature. Does anybody know if the OS X Calculator has the same problem? I would bet the iPhone version is nothing more than a port of the code.

August 27 2008 at 8:27 PM Report abuse rate up rate down Reply
Dmitry Chestnykh

Calculator.app on Mac behaves correctly.

August 27 2008 at 7:48 PM Report abuse rate up rate down Reply
Fsck

Clearly this is the much anticipated return of the PENTIUM FLOATING POINT BUG! Intel wolves hidden under an Apple sheepskin. Black Helicopters. Truth Serum. Oh yes....

August 27 2008 at 10:56 AM Report abuse rate up rate down Reply
MacDoc

Letters and Numbers should never be Mixed!

August 27 2008 at 5:45 AM Report abuse rate up rate down Reply
Daniel

I must have the most awesomest iPhone ever cause it works fine for me. I did 3.141592654x2+5 and got the same 11.283185308 answer. Then I did 2x3.141592654+5 and I got 11.283185308 again. I guess if I entered mure numbers for pie then I'd have gotten the bug but with the instructions TUAW is giving it works fine for me.

August 27 2008 at 1:08 AM Report abuse rate up rate down Reply
germ

Apple, give us a proper scientific calculator, that is, an RPN calculator, please!

August 26 2008 at 10:48 PM Report abuse rate up rate down Reply
Joe

'"1 + 1" it could manage ("2"), and "1 + 2" ("3") and "2 + 2" ("4") or "tan 74" ("3.4874145"), but anything above "4" it represented merely as "A Suffusion of Yellow".'
http://www.thateden.co.uk/dirk/

August 26 2008 at 9:01 PM Report abuse rate up rate down Reply
Vineet Shah

You've got me convinced. Misjudgment on my part. I do believe that after pressing the + sign in 2*pi+5, the value of 2*pi should be calculated. I guess I'm just naturally used to pressing the = sign after using symbols like pi, especially after seeing the * button still highlighted. Seeing the button highlighted was the main reason I never came across this bug, since I always pressed = to complete the calculation.

And yes, it's definitely not a postfix notation calculator, but all "classic" calculators behave in such a way that only one value is stored in memory, and newer calculations will replace that value in memory. "Stack-based" was not the correct term for this.

August 26 2008 at 5:48 PM Report abuse rate up rate down Reply
1 reply to Vineet Shah's comment
Dr. Drang

A remarkably mature response. I hope you didn't take offense to my joking references to your relative youth.

August 26 2008 at 6:45 PM Report abuse rate up rate down Reply
Vineet Shah

It's still the way it expects the user to enter in values. I agree that this isn't RPN, so it may not be directly stack-based, but similar to a stack-based calculator, it is picky about how you enter values, especially symbols such as pi. Another example is trying to find 2 + cos(30). The proper way to type it in is cos -> 30 -> + -> 2 -> =. Typing it any other way will not yield the proper answer, about 2.87, significant to 3 digits I believe for a trigonometric value. But nevertheless, in that way, it is very similar to RPN on the HP graphing calculators, since order matters. First the value, such as 30, then the function, such as cosine. Similarly, first any special digits such as pi, followed by an operator, then any operand. You will notice how the multiplication symbol stays highlighted until you enter a real second operand.

The best way to put this is is that by pressing pi, it is just showing you its value, a property of many calculators. To actually use this value, it must be entered first, OR you must press the equal sign. Again, notice how until you press the equal sign in 2*pi=+5, the multiplication sign will stay highlighted. Until you press the equal sign, the value of 2 * pi will not be entered on the stack; the only number on the stack will be 2 and the operation will be incomplete. To perform the operation, the = sign must be pressed.

August 26 2008 at 5:18 PM Report abuse rate up rate down Reply
Scott

Never trust the numbers ANY computer gives you.

The first problem with this discussion is that the "correct" answer is 11.28318530717959. It isn't. Its only, what, 11.28 or 11.3 (I forget which, it's been a while since I've done "real" math; but its a classic 1st year engineering school mistake - one our slide rule bearing ancestors would never have made). You're assigning way too much significance to all those extra digits. Or do we know for a fact that it really is 2.000000000000000 and 5.000000000000000 and not just 2 and 5?

Second, and far more importantly here, all digital computer have problems with floating point numbers. Its in their nature. They do binary integers and binary integers only. They have to do some mathematical trickery to do floating point numbers and bad things can happen when you fill up the register with ones and zeros (Is it a really large integer, or a really small decimal number, for example.). You get problems when programers get sloppy and don't account for these edge cases properly. Which is obviously the case here. (And why high end scientific calculator have special placeholders for numbers like pi, use algebra whenever possible instead of arithmetic, and save turning pi into a decimal approximation until the end, if ever.)

In short, you should never trust the numbers that any computer gives you. You should always ask yourself "is this the answer I was expecting?" And no, it doesn't matter if its a $200 hp rpn, an Excel spreadsheet, or especially, a throw away calculator app.

Oh, and the "stack" has nothing to do with it. If you're getting "7" when you calculate "2*pi+5", the calculator app is flat out dropping pi altogether, not changing the precedence of * over +.

August 26 2008 at 4:50 PM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.