I found this problem today in a German online paper. First published in 2019.
(“The web is desperate about this problem”)
The solution is surprising. Maybe you can ask a friend (or test yourself).
SPOILER.
Different calculators, even from the same brand (depending on age) show different results.
I wonder what computer show what result.
Both 1 and 16 are correct.
One said, that there is no solution as the syntax is wrong or not specific enough.
You can’t trust a calculator or computer, you first have to think how to use it.
Funny debate.
I did have this debate with others elsewhere some time back when I was moaning about “smart phone” calculator app - it changed from left to right to BOMDAS with an update, so I had to search to find another calculator app. which had strict LR evaluation…
… because the very first electronic calculator I owned (and the majority in the mid/late 70s) were strict LR and while I fully appreciate and understand BOMDAS (and variants), simple calculators were and should still be LR (IMO!)
My old calculator (Imperial 99T) doesn’t have ()'s so because BOMDAS is in my head, (and was in my head before I got a calculator) I have to evaluate that separately, so:
2+2 = M+ (4 in the memory)
then
8 / 2 * Mout
= 16
To get 1, I need to do the ()'s first [4], then multiply by 2 [8] then divide 8 by that to get 1.
If I just ignore the ()'s then I end up with 10. (Not wrong just not right!)
My own BASIC interpreter uses the Shunting Yard algorithm then RPN evaluate the resultant stack. It treats divide and multiply with equal precedence so the evaluation stack ends up with
As far as I can tell, since this is a German quiz, in the German, Austrian, etc, system there is no precedence between multiplication and division. If you write it linearly, whatever comes first is solved first. (There is also no deeper binding to terms like “2A” or “2(A + B)”, it’s the same as “2 × A” and “2 × (A + B)”.) If you write it as a fraction, things are different, since there are separate linear terms to be solved before you address the over-all fraction. – So, the solution should be 4 × 4 = 16.
(That is, in Germany, Austria, etc. I know that some regions and school systems handle this differently. Hence there is no universally right solution.)
*) There are, of course, PMDAS and GMDAS, but in German speaking countries there are just “dot calculations” and “dash calculations” (Punktrechnungen and Strichrechnungen), putting multiplication and division, and addition and subtraction, into a basket each, and groups are solved first, from the inside out.
Is 2 + 2 = 5 for extremely large values of 2 true here?.
Remember back the you had full sized and pocket calculators back then.
I suspect full sized ones,runing off mains power, had the correct result.
Amazing how this keeps resurfacing year after year. The bottom line is that the notation is ambiguous, despite the ostensibly simple rules and mnemonics taught in school. Conventions on how mathematicians interpret these ambiguities have also shifted over time, but in general is inferred from the context [searching for the reference].
One of my early memories from shortly before I could read but could at least copy letters, I wrote down some sequence of letters and asked “what does this say?” The answer, of course, is that some sequence of letters might not make any sense. And so it is here…
I’m not sure how my Sharp Compet 361 Desk Calculator would handle this. It has a very strange input notation, not one I’ve been able to work out. It appears to have an undocumented square root function too
Undocumented square root sounds interesting! How did you find it? How is it activated? Might it perhaps be buggy or might it perhaps be for the next model up?
In the programming courses, we were always advised not to simply code formulas as they were found, but always to rearrange them so that the multiplications were carried out first, in order to avoid accumulating rounding errors with floating point numbers.