3 ms·
Another interesting calc.exe quirk: On "Standard" view, type: 1 + 2 * 3 = Answer comes back as 9 Switch to "Scientific" view and type the same, Answer come
by user24 16y ago
Another interesting calc.exe quirk:
On "Standard" view, type:
1 + 2 * 3 =
Answer comes back as 9
Switch to "Scientific" view and type the same,
Answer comes back as 7
The reason (of course) is operator precedence; in standard mode it's interpreted as "1 + 2 =" then "* 3 =", while in scientific view it respects BODMAS.
But to me it's counter-intuitive that changing the View also changes the Mode of operation.
If they'd just named that menu "Mode" instead of "View" I'd be fine with it.
- andrerobot 16y agoI've used cheap scientific calculators that perform operations from left to right. It's awful when you are answering a uni exam and you don't know why the results you get looks fishy. On computer calculators, I always type "1 + 2 * 3 =" as "2 * 3 =", "+ 1 =" because I learned the hard way that I can't asume that a calculator is going to respect order of precedence or not.
- sprout 16y agoI think the first calculator I used was one of those. It took me till college and programming before I really properly learned precedence because I never trusted any calculator I was using, and always used parentheses. This also kind of influences my programming, probably for the better - I would rather use parens and be clear than be ambiguous and trust that my interpreter and I agree on what has proper precedence.
- dchest 16y agoMac OS X Calculator gives 7 in any mode. Wow, thanks for the information.
- jacquesm 16y agoThe 9 is just plain wrong. Operator precedence is not a scientific thing, that's a grade school thing.
- dchest 16y ago(1 + 2) * 3
- jacquesm 16y agoYou've just changed the precedence.
- dchest 16y agoThanks, I know. I meant that most non-scientific calculators I used worked this way.
- jacquesm 16y agoThat doesn't make them less broken! And if the software has the capability to do it right why bother building in a 'broken' mode.
- evilduck 16y agoIt reflects the old paper tape usage model, where you typed it in in the order you wanted to perform the operations. Apple's Calculator.app works similarly, although their default state is better. If you open up the "Shown Paper Tape" window, and type "1 + 2 * 3 [enter]", it replies "1 + 2 * 3 = 7" If you then type "1 + 2 [enter]", it replies "1 + 2 = 3", then if you hit " * 3 [enter]" it replies "1 + 2 * 3 = 9".
- jacquesm 16y agoYes, I can see how the 'enter' would force the precedence. The '=' key will do the same.
- user24 16y agoI think it's because non-mathematical people tend to use calculators in the 'broken' way. Their thought process is "ok, 1+2" (implicit equals) "times 3".