Next post Previous post

Update

The bug described in this post was fixed in the iPhone 2.1 software update.

In an earlier post I said that I didn’t like the way the iPhone scientific calculator handles the scientific notation (EE) key. That bug seemed to be mainly a stylistic matter—the calculator display treats the mantissa and the exponent as separate numbers rather than as two parts of the same number. Yesterday I found a more serious bug in the way the π (pi) key is handled.

Turn your calculator sideways to put it in scientific mode and tap this out:

π × 2 + 5 =

You’ll get the correct answer of 11.283…

Now try the same thing, but with the 2 and π reversed:

2 × π + 5 =

You’ll get 7! The π gets lost when you push the + key. If you do

2 × π = + 5 =

you’ll get the right answer, but there’s no reason you should have to hit the = key in mid-equation.

Watching the display as I step through the equation that gives the wrong answer, I see that after touching the × button, it is outlined in white, indicating that the calculator is waiting for the second argument. The white outline remains after touching the π button, which I think means that the calculator doesn’t believe that the second argument has been entered. If I do

2 × 5

the white outline disappears from the × button after I touch the 5, which is the correct behavior.

I’m shooting off a bug report to Apple in hopes that they fix this soon. In the meantime, if you use the iPhone’s scientific calculator, beware of this bug in formulas that use π. I’m not sure of a foolproof way of avoiding it. I’ve tried putting the π first in all terms that have it, but

5 + π x 2 =

gives an answer of 10. I’ve tried parenthesizing the π terms, but

5 + ( π × 2 ) =

also gives 101. It’s stunning that

Apple couldn’t get a simple calculator program to work right, and No one in QA found this bug before it shipped.

Next post Previous post