More calculators…
In my last post, I ranted about the behaviour of the Gnome calculator. But as Robert Watkins pointed out - not all calculators are equal. In fact their behaviour is all over the place. Here is my survey of OS systems within my reach:
| Calculator | Basic Mode | Scientific |
|---|---|---|
| MacOsX | CORRECT | CORRECT |
| Windows | WRONG | CORRECT |
| Gnome (Fedora Core 3) | WRONG | WRONG |
| Gnome (more recent) | CORRECT according to the website | CORRECT according to the website |
| KDE | CORRECT | CORRECT |
CORRECT = Obeys the laws of Mathematics. Ie 2 * 2 + 2 * 2 = 8
INCORRECT = Defies the laws of Mathematics. Ie 2 * 2 + 2 * 2 = 12
So next I have to dig out some mechanical and handheld calculators and try it on them. So far it seems that TI ’scientific’ calculators have been correct at least since the 1970s which makes sense and explains why I had the understanding that all calculators work that way - that is the sort of calculator I used in high school, and I would hope that is the kind used today - not TI necessarily, but something that is correct.
The Nokia phone that I use is wrong - but then I have never used it to do calculations.
Googling for recommendations about calculators for students, it seems that at least the Irish education authorities recommend: “If the calculator executes operations in the order in which they were keyed in, the answer displayed will be 14 - which is incorrect. If the calculator follows the conventional order of precedence for arithmetic operations, it will display the correct answer, 11. The first type of calculator is referred to as an arithmetic logic calculator. Many four-function and desktop business-style calculators are of this type. Virtually all scientific calculators, on the other hand, are of the second type. These are called algebraic logic calculators, and they apply the conventional rules of precedence to any sequence of arithmetic operations. Scientific calculators with algebraic logic are recommended for post primary students.”
I guess this is a lesson that the kind of usability that is basically lacking in the real world, the kind of problem that we often don’t notice until one day it bites us like it did me today. And how easy it is to overlook these problems
For an example of how easy it is to overlook basic usability like this, did you ever notice that calculators and keyboards have their keys in the opposite order to phones? Why is that? And why does an ATM match a phone not a calculator? What if you had to enter your PIN on a computer’s numeric keypad? Would you get it right?
February 1st, 2005 at 7:26 pm
A rule of thumb, for me, would be that if it shows an interim result, then it should be an arithmetic logic calculator. The reason is simple: I could stop halfway through, come back, see the number, and proceed where I left off. Thus, the Windows XP calculator is “right” in the standard mode, and “wrong” in the scientific; it’s very disconcerting to see ‘6′ in the window, then multiply it by 2 to get ‘8′.
(As an aside: if you’re teaching students how to read equations, it’s better to give them arithmetic logic calculators; they can use the calculator to do the arithmetic while learning how to read the equation. Giving them the more powerful calculator hinders that)
The numeric keypad/ATM thing is easier to explain: two design decisions made at about the same time, when neither had much momentum. There was a 50/50 chance they would end up different. :)
February 1st, 2005 at 8:03 pm
My Windows XP calculator doesn’t display the 6 in scientific mode - entries (display):
2 * (2)
2 + (4)
2 * (2)
2 = (8)
which is not quite as disturbing.
My Palm Tungsten T3 comes with an arithmetic logic calc. Its number keypad is arranged in the same way as a phone’s… not the same way as most numeric keypads. I guess this may be because they also produce the Handspring Treos, which are phones.
February 1st, 2005 at 8:39 pm
Operator precedence is not a mathematical LAW, it’s a mathematical CONVENTION. There are lots of different methods of writing and evaluating expressions. E.g. Polish (used by LISP), Reverse Polish (Forth), etc. The method you don’t like is the same as used by several programming languages, including J and Smalltalk. The use of an evaluation convention is a trade-off between the advantages that the convention provides vs. the disadvantage of unfamiliarity to people who are used to what they learned in high-school maths.
I agree that a calculator aimed at the casual user should follow the most widely used convention. But even calculators don’t follow this rule when aimed at a specific markets — HP’s engineering calculators use RPN notation.
February 1st, 2005 at 8:41 pm
By the way, your spam filter is inaccurate. I could not write the word “s-p-e-c-i-a-l-i-s-e-d” (without the hyphens) because your filter didn’t like the sequence “c-i-a-l-i-s”.
It’s lucky you’re not writing about Scunthorpe.
February 1st, 2005 at 9:03 pm
Of course Nat’s right - the rules of precedence are just that - rules. I guess it comes from my background in pure maths and physics that I just assume that all calculators work like the ones I have used all my life.
Not being a smalltalker myself I haven’t noticed that language’s precedence rules - but almost always I parenthesise (sp?) or refactor in my code - whatever the language - to make it absolutely clear.
Robert’s observation (in his blog) that mechanical calculators show running totals is an interesting one - and of course makes sense if you are always doing additions, as I guess is the standard user story for a mechanical calculator.
It does stick in my craw though, that a user of a mechanical style calculator has to write down the intermediate result to perform 2*2 + 2*2 - it seems really wierd to me.
I guess for a modern calculator, the question is more why don’t we show a paper trail in that case - make it explicit how the thing works. I’m sure I’ve seen that somewhere…
February 2nd, 2005 at 2:39 am
Just for yout information, I tried it on my Treo 650 calculator, and I get 12 in the standard mode, and 8 in “advanced” mode.
February 3rd, 2005 at 6:24 am
Doesn’t your typical calculator keep a running result and not remember how it got there?
IE it would end up as:
(((2 * 2) + 2) * 2) = 12
And you have to implicitly tell it not to by using:
(2 * 2) + (2 * 2) = 8
I remember being involved in writing a JDO type thing that generates SQL on the fly, the brackets it used where quite interesting!
SO the lesson here is avoid ambiguity and learn to embrace the brace.
February 13th, 2005 at 6:46 pm
Ah yes, that numeric keypad thing is a bummer, which goes a long way to explaining why I can’t use the calculator at work that has all the numbers worn off the keys, thank you my friend. And hell, email me. It’s been far too long.
Oh yeah, three more things of note 1. I had lost your blog address (along with your email) so I googled you. Came up first hit. Gotta be happy with that, yeah? 2. watching the Sound of Music “what is it you cunt face?” thought of you 3. singing Brahms Deutsche Requiem with Choral Society with the inevitable memories of being surrounded by you, Pianezze, and $1.20…
XXX
crit
BTW - where’s your “email me” toggle???