But what if different calculators give different answers ?

Two modern calculators.

Both made by the same manufacturer, Casio.

Type 6÷2(1+2)= into one and the response is 1, but on the other, it's 9.

Mathematics abhors a contradiction; they cannot both be right.

Yet when I asked some A-level mathematics pupils which was correct,

they quickly polarised into two equal groups,

each arguing passionately for one of the two suggested answers.

Out came the iPhones.

"We've got an App for that, Sir!"

Try it; 6÷2(1+2)=

Incredibly, the iPhone's standard built in calculator gives an answer of 2.

I kid you not.

Wow!

That stunned them all.

No one could explain that.

What the hell was going on ?

At this point I did not want to simply state the correct answer.

However, my class clearly needed a hint of some sort.

In a corner of my classroom is an old Acorn Risc PC, so I switched it on.

As it powered up I explained that thousands of applications had been written

in a computer programming language called BBC Basic and that something

so tried and tested was unlikely to get the calculation wrong.

This was, of course, pure theatre but they were all gripped as I typed in;

<f12>

*basic

PRINT 6/2*(1+2) <Return>

So, there it was; 9.

I have cheated a little here.

Have you spotted that I've put in the implied multiplication sign

which is the * in BBC Basic ?

Back on the iPhone, carefully typing in 6÷2×(1+2)=

with the implied × specifically inserted also gets the answer 9.

What a great example on the dangers of using iPhones as calculators !

It's time to explain what is going on:

I hope you enjoy typing 6÷2(1+2)= into your

calculator and seeing what you get.

James : You can always count on BBC Basic to get it right :)

Matthew : BBC Basic will be on Raspberry Pi. I'll use this lesson when mine arrives!

Chris M : My Casio fx-83GT PLUS which everyone in my school uses gets it wrong if you miss out the × but right if put in.

Colin Wright : I've blogged about this. It's a question that just keeps coming back again and again.

bhtooefr : Here in the US, we're taught PEMDAS - so it'd be 1+2, then 2*3, then 6/6, which equals 1.

timothyjrhill : Thet are all correct, if operator precedence of the different things is taken into account.

Victor Quiros : This is unbelievable. It's why I prefer #RPN.

Martin Hansen : Ah yes. #RPN = Reverse Polish Notation. My first calculator used that. Used to lend it to people and wait for the question "Where is the = sign?" You are right though. None of this nonsense with #RPN.

Vintage8bit : PEMDAS better written as PE[MD][AS] - Parens, Exponents, Mult & Div in order, Add & Sub in order. This gets you 9.

David Pitt : When I went to school, a long long time ago, one of the Maths teachers went by the nickname of Bod. I only found out why that was in the fourth year when he started to talk about te orders of calculation and used the numonic BODMAS. But that was then, long before calculators.

Martin Hansen : Slide rule in your day, David ? I had an emotional exchange with my dad when he decided the time had come to hand on his slide rule. I didn't have the heart to tell him that my Sinclair calculator with glowing purple digits had rendered it obsolete. In the UK BODMAS=PEMDAS.

Richard Ashbery : I believe BBC BASIC uses PEMDAS where the logical order is...

Parenthesis

Exponent

Multiplication & Division (same rank)

Addition & Subtraction (same rank)

Where the calculation contains the same rank then the operation must be done starting from the left so in the example below division has priority over multiplication.

So 6/2*(1+2) becomes 3*(1+2) = 3*3 = 9

Wouldn't we be in a hopeless mess if we didn't have the ancient rules ? It's worrying that some calculators get the wrong answer.

Hairy Dalek : I just tried 6÷7(1+2) on the iPhone which gives 2. It's throwing away the 7 or whatever other digit is in that position.

Martin Hansen : Progress. Hairy Dalek, you've sussed out what the iPhone is doing. Thanks!