Christ Stevenson bitched about the Gnome calculator Apparently, if you enter the equation ‘2*2+2*2’, it gives an answer of 12.

Written down, as above, operator precedence comes into play. Humans (and equation-solving programs) are meant to understand operator precedence, and know that the equation listed comes to 8. But a calculator is not an equation solver.

Most electronic calculators are modelled after the older mechanical calculators. These devices didn’t solve equations: they performed simple arithmetic, on two values at a time. As such, it would evaluate the above equation in the order of entry, at each step working out the new base value: 2 * 2 = 4, + 2 = 6, * 2 = 12. The mechanical nature of these devices meant that no other solution was possible. People who had to use mechanical calculators simply made sure that they re-arranged the equation as required, possibly factoring it a few times as they worked out sub-equations. ‘2*2 = 4. Okay, that’s the first half. Write that down. Second half: 2*2 = 4. Ok. Now, 4 + 4 = 8!”. The mechanical calculator took away the arithmetic, not the work involved in understanding the equation.

Electronic calculators followed the user interface paradigm set by the the mechanical version. And, of course, calculator programs followed suit.

To put it bluntly, a calculator is not an equation solver. It doesn’t accept an entire equation in a single pass, waiting for you to hit an ‘evaluate’ button; it evaluates as you go, as you enter. For most “kitchen arithmetic” problems, this is fine. For trickier work, you use an engineering or scientific calculator, which typically *can* construct an entire equation in one pass. Or, in software, you use a spreadsheet or a mathematical program instead.

So, in calculator land, 2*2+2*2 really does equal 12. Not 8. If it helps, think of it as ((2*2)+2)*2… that’s what the calculator does.

**Update**: In accordance with that rule, the Windows XP calculator, in standard mode, will evaluate to 12, whilst in scientific mode, it will evaluate to 8.

### Like this:

Like Loading...

*Related*

## Author: Robert Watkins

My name is Robert Watkins. I am a software developer and have been for over 20 years now. I currently work for people, but my opinions here are in no way endorsed by them (which is cool; their opinions aren’t endorsed by me either). My main professional interests are in Java development, using Agile methods, with a historical focus on building web based applications. I’m also a Mac-fan and love my iPhone, which I’m currently learning how to code for.
I live and work in Brisbane, Australia, but I grew up in the Northern Territory, and still find Brisbane too cold (after 22 years here). I’m married, with two children and one cat. My politics are socialist in tendency, my religious affiliation is atheist (aka “none of the above”), my attitude is condescending and my moral standing is lying down.
View all posts by Robert Watkins

Cue the comments on the superiority of reverse polish calculators and so on…

Actually, an RPN calculator doesn’t help with the problem of entering the equation as written: 2,2,*,2,+,2,* = 12. However, if you break it up a bit more and mentally apply the order of operations, it helps: 2,2,*,2,2,*,+ = 8.

The point still remains that a calculator is not an equation solver.

I’ve been playing with Longhand for OSX, and it does the right thing with the equation you showed.

http://longhand.pansophists.net/

It’s a pretty impressive example of “do one small thing well”.

Yes, I guess you still need to do the equation factoring to get it in RPN, but once there, a RPN calculator can work with it. A “mechanical” calculator however can not. Other then the much loved HP uber calculators from uni days.

So how long (in time) should the metaphor be used? Given that we have been born in an age where the basis of the metaphor is long gone – is that justification for dropping the metaphor? If not, then is it not really a metaphor, but just the way it is.

I can’t remember the url, but there is a site that dedicates itself to getting stuck into inappropriate UI metaphors. Interestingly it gets stuck into apple and osx a lot (especially quicktime) for using physical metaphors that make it a tad fiddly with the mouse. Yet on the whole people love things like that from apple (iTunes is probably included).

I remember as an (ex) avid user of digital audio workstations (DAWs) like pro tools, paris, cubase and so on, that many of them liked to reproduce (in loving detail) mixing desks, and classic effects racks. Yet it would be much more efficient to use normal UI controls. The ones that used normal UI controls were less then popular (other then parts of pro tools) as we still loved the illusion. I have never got my gready hands on a LexiVerb, or a Roland RB303 (never seen one) yet I wouldn’t touch the screen version unless it looked like one. Interesting…

How long should the UI metaphor remain? How about forever?

The vast majority of users of calculators do simple aritmetic, usually involving totalling up lists. “Kitchen arithmetic”, in other words. The UI interface of single operator evaluation works very well for this.

More sophisticated users have other tools available to them.