Panther and Tiger calculator app:
1 + 2 * 3 = 7 (correct)
Dashboard Widget and Jaguar app:
1 + 2 * 3 = 9 (incorrect)
Hopefully they'll fix this one in a future update...

Just a headsup when using the Calculator widget in Dashboard. Apple fixed the calculator bug in Panther (it was present in Jaguar), but the bug made it back into the Dashboard Widget in Tiger. The issue is the adherence to the PEMDAS order of operations we all learned in grade school: parentheses, exponent, multiplication and division, addition and subtraction. An example:
Panther and Tiger calculator app: 1 + 2 * 3 = 7 (correct) Dashboard Widget and Jaguar app: 1 + 2 * 3 = 9 (incorrect) Hopefully they'll fix this one in a future update...
•
[22,901 views]
Hint Options
10.4: Be aware of a Calculator widget bug
The whole calculator app has problems in Tiger. I reported this to Apple but basically if I open the calculator app (Basic, let's say) then close the window (but not quit the app) it USED to be that if you clicked the app in the dock the window would open back up, no go. Try selecting Basic from the menu in the app and it STILL won't come back. Now try quitting the calculator app from the application menu, won't quit. You can only quit it from the dock menu and then launch it again to get the calculator window back.
10.4: Be aware of a Calculator widget bug
Have you seen this thread? I had similar problems and found this to be the source of my troubles.
Make a new one?
I haven't had time to install Tiger yet, so maybe I missed something, but isn't the point of "widgets" that you can just make your own calculator *fairly* easily? Considering all the effort going into this post, I imagine it's a good candidate for a "pick of the week".
10.4: Be aware of a Calculator widget bug
This is not necessarily a bug, it is the way it is supposed to work. If you pick up any calculator and type 1 + 2 * 3 you will always get 9. In fact, in my personal opinion, I think the other way is a bug, because it assumes that I always want to multiply, or divide, before I want to add or subtract.
10.4: Be aware of a Calculator widget bug
No, this is clearly a bug. At one time Apple attempted to finesse it by having the standard order of operands work properly in "scientific" mode, but this incorrect lefttoright order (i.e., not recognizing the operator precedence that everyone (should have) learned in junior high, if not earlier) in "basic" mode. Other than cheapo $5 models, any decent calculator will get the precedence correct. Why should a Dashboard widget on a $500  $2500 computer imitate the mathematical errors of a $5 calculator knockoff? Sorry, I'm not interested in a flame war, but I cannot see the justification.
In any event, this hint is very helpful, as the lack of consistency is arguably even worse than having it incorrect. Thanks.
10.4: Be aware of a Calculator widget bug
Different calculators behave differently, even in the physical world. As you said, $5 cheapo calculators have always worked this way. To me, that's exactly what the calculator widget is supposed to be modeling. And the calculator shows the intermediate results, so you ought not be surprised with your final answer.
10.4: Be aware of a Calculator widget bug
Actually, I have a fairly expensive TI graphing calculator that when I enter the proplem in that order always gives me the answer of 9. Assuming that this was a written out problem then yes the answer should be 7, but when you enter it into a calculator it will always to the math the order in which you enter it. Which would mean it does the addition first then the multiplication. Every calculator I have ever used does it this way. The calculator in Windows even does it this way. So the way I see it, if every calculator, since there were calculators, has done it a certain way, then that is the correct way.
10.4: Be aware of a Calculator widget bug
Right. Notice that, using the problem in the original post, when you hit the "x" the screen displays"3" from the previous 1+2 operation.
10.4: Be aware of a Calculator widget bug
In fact, the Windows calculator behaves differently whether it's in basic or scientific mode. Basic mode ignores operation precedence and scientific mode follows it, just like real world basic and scientific calculators do.
10.4: Be aware of a Calculator widget bug
Sorry, but you're wrong. I just pulled out both my TI35X and TI85 (can't believe the batteries still work after ten years) and both give 7, which is the correct answer.
10.4: Be aware of a Calculator widget bug
I don't know, but I think the problem is that two different methods of inputing the numbers are being talked about. In other words, if you input "1 + 2" and hit enter (or equals) you get "3". Then if you hit '*3' you get "9". But if you input "1 + 2 * 3" all on the same line and then hit enter you get "7", because it follows the standard order of operations. I think this is where the misunderstanding is coming from on the Ti calculators. I'm not sure about the Mac, since I don't have one in front of me right now.
10.4: Be aware of a Calculator widget bug
You keep saying this, and you don't seem to realize that it's irrelevant.
Order of operations
"Mathematics is not open to debate or your personal preference. Order of operations is correct, left to right is wrong. Period."
Order of operations
No, order of operations was not determined arbitrarily. It has to do with getting accurate answers. Since multiplication is repeated addition, it MUST be done before simple addition or you will get an incorrect answer and your bridge will collapse, your engine explode, etc.
10.4: Be aware of a Calculator widget bug
What everyone is ignoring here is that operations entered into the calculator app (both the standalone app and Dashboard widget versions) are not entered "lefttoright". They are entered "firsttolast", separated chronologically, not spatially. When you write out a problem on a piece of paper like this:
you are able to view the entire problem at once and determine the correct order of operations. On the other hand, what if I walked up to you and said "Quick, what's one plus three?" and then after you'd answered "4", I continued with "...times two?" How would you know if I meant 1 + 3 * 2 or (1 + 3) * 2? In that situation, you'd most likely assume the latter, and so does a calculator that shows only one value at a time. The reason graphing calculators get it right isn't because they are more expensive. It's because you enter the entire formula, which is shown on the screen as you enter it, before you hit "equals".
10.4: Be aware of a Calculator widget bug
All discussion aside. if this is a math rule OR even if it is a convention then in both instances 'every' calculator should follow this, wether convention or math rule. Because less educated people (or young children) might learn it wrong or actually think that 1+2x3=9. Imagine taxinstitutions using this kind of calculus to get your tax cut (would you rather pay $7. or $9.) :))
10.4: Be aware of a Calculator widget bug
I agree with you here, it's a bug.
10.4: Be aware of a Calculator widget bug
No, this is a bug. Mathematical order of operations does not change because some insanely poorly done calculator doesn't support it, or because you don't like it. Math such as this is not open to debate or preference  it is wrong, and should be fixed.
10.4: Be aware of a Calculator widget bug
This is not a bug. As has been said before it behaves like all $5 calculators that calculate numbers as they are given. Cheap calculators do not remember long equation strings they only deal with opertations between two numbers at a time. When you enter this equation into a cheap calculator, it can only deal with numbers in the order that they are given so 1 + 2 = 3 then 3 x 3 = 9. This is fairly obvious and has always been the way cheap calculators work. If you want a more advanced calculator then you pay for it. Here you can just use the actual app. That said, this behavior is very easily noticed, there's no way that Apple could have accidentally missed this behavior if it was not intended.
10.4: Be aware of a Calculator widget bug
Actually with a cheap $5 calculator, you cannot enter a complex calculation and have it evaluate the entire calculation at once. Such calculators are only capable of evaluating two operands with a single operator. So it's not possible to enter 1 + 2 * 3.
10.4: Be aware of a Calculator widget bug
I believe it works like the old skool CPA calculators (The ones with the little receipt rolls), you have all seen them.
To those who still think 1+2x3=9
Those who think 1+2x3=9 probably hated math in school because they thought it was a purely abstract subject. Well, maths ARE the real world.
10.4: Be aware of a Calculator widget bug
This is exactly why I use RPN instead of standard algebraic notation.
10.4: Be aware of a Calculator widget bug
Intuitive? Huh? I'll agree that it's nonambiguous, but intuitive, no. When I see 1+2*3, I think "One plus two times three", and that's how I expect to punch it in. I do not think "One Two Three Plus Times", so RPN is not intuitive; nonambiguous, sure, but not intuitive.
10.4: Be aware of a Calculator widget bug
It's not necessarily unintuitive, it's just different from what we're taught in school. I learned RPN when I got an HP 48GX for college, and I've never looked back. The appeal of RPN entry is that it's simpler and, as you said, not ambiguous. You first provide the data you're working with and then specify what you want done with that data. It comes down to personal preference; I think it's easier to work in RPN.
10.4: Be aware of a Calculator widget bug
Actually, in RPN, if you wanted to do 1+2*3 you would do 1 2 3 * +.
10.4: Be aware of a Calculator widget bug
Actually, it's 19 vs 19 keystrokes, not 14 vs 28. For the RPN you forgot to count the ENTERs between values (otherwise 2 8 is 28), and for nonRPN there were too many parenthesis as you said (and the last one can be dropped because = closes it automatically).
"Intuitive"
"more intuitive once you get used to it" is a contradiction. To me 'intuitive' applied to software means it works the way you expect the very first time, and you don't have to get used to anything.
"Intuitive"
Exactly. Freaking "rocket science" is intuitive if you are a rocket scientist...
10.4: Be aware of a Calculator widget bug
Well, it's just javascript. I'm at work and can't mess with the source, but it may not be too hard to modify.
10.4: Be aware of a Calculator widget bug
Well, it's just javascript. I'm at work and can't mess with the source, but it may not be too hard to modify. It will probably be harder than you think.
Implementing PEMDAS
Probably harder than you think. I agree. As the user enters numbers and operators, you've got to keep track of what's been entered and what's okay to calculate now. With lefttoright entry and evaluation, you can evaluate expressions as the user enters them. This is probably why Apple went with LTR over PEMDAS  it's easier to implement. To implement PEMDAS, you really need to have parenthesis available, or you're not able to use the intermediate result of a lowerorder calculation as an operand to a higherorder calculation. For example,
Implementing PEMDAS
Not really, all you're doing is building a string to send to the JavaScript eval() function. The engine handles PEMDAS just fine and since there aren't buttons for P and E, it's limited right now to the rather simple MDAS.
Implementing PEMDAS
I've got the JavaScript done for a dropin replacement if anyone wants it. I'll start messing with a polished implementation with a setting on the back et. al., but I've done a lot more JavaScript than I have widget work, so I don't know when it will be done.
Implementing PEMDAS
Option Enabled MDAS awareCalculator Widget variant.
10.4: Be aware of a Calculator widget bug
This is not a bug! You don't type 1+2*3 into a single screen on the calc widget. Every time you hit an operator (+,*,,/, etc) it evaluates the arguments.
10.4: Be aware of a Calculator widget bug
On all three of my calculators, it properly obeys the order of operations, regardless of what the display shows, which is correct.
10.4: Be aware of a Calculator widget bug
I think everyone agrees with you on the order of operations. Everyone know "Please excuse my dear aunt sally" or however you learned to remember it. But, I think there are different types of calculators that do things a little differently. I'm, unfortunately, in front of a windows machine right now and I checked out the calc app that is on this machine. Using it in standard mode and typing in the numbers gives me 9, but when I switch it to scientific mode I get 7. I think the calc widget is mimicking one of those cheap calculators that is doing the math step by step instead of considering the numbers as on continuous argument. On those calculators, any time you hit an operator sign, it uses the answer from the step before. In other words, when you type in 1 + 2 and then hit * 3, what the calculator is actually doing it 1 + 2 = 3 * 3 = 9. In my experience this is how most cheap calculators work. I've used a Ti83 for the last 810 years, so I'm just used to typing in all of the numbers on one line and then hitting enter. Anyway, I hope this clears up any problems and misunderstandings.
10.4: Be aware of a Calculator widget bug
Look, the calculators you own are obviously designed more recently  I suspect they are scientific or student calculators that understand precedence.
10.4: Be aware of a Calculator widget bug
You're so right old fellow! These young whippersnappers just don't understand that it's up to them to get it right! Actually the rules they cite, taught to them in the third grade, were intended to teach them how to simplify an arithemetic equation in a multistep fassion and do not apply to a binary operation calculator. Evaluate everything within parentheses first and rewrite the simplified equation, apply exponents and rewrite the equation, etc.
10.4: Be aware of a Calculator widget bug
That's what it is!
10.4: Be aware of a Calculator widget bug
"This will be my third post saying it"
10.4: Be aware of a Calculator widget bug
It's not strictly a bug, but it is a very poor decision by Apple.
10.4: Be aware of a Calculator widget bug
As others have pointed out, this clearly is not a bug. The calculator widget both visually and in its behaviour is a simple stepbystep calculator.
10.4: Be aware of a Calculator widget bug
As I have consistently pointed out, this is most certainly a bug. Math doesn't change because developers are lazy. Now, if they want to clean up the interface, I'm all for that, but left to right is not correct under any circumstances.
10.4: Be aware of a Calculator widget bug
No one is claiming that math changed. All that is being said here is that the calculator is just calculating one operation at a time. This is standard and expected behavior of calculators of this sort. The only nongraphing calculator I have ever seen that used order of operations was one with advanced features like parenthases.
10.4: Be aware of a Calculator widget bug
Standard scientific calculators you get in year 8 use BIMDAS.
10.4: Be aware of a Calculator widget bug
Have you reported this as a bug in Apple's RADAR system? If not, I'll be glad to.
10.4: Be aware of a Calculator widget bug
No, I have not. If you could that would be great. Thanks for sticking to your guns in the posts above :)
10.4: Be aware of a Calculator widget bug
This discussion, while fervent, is pure semantics: bug versus not a bug. It is quite amusing to see how worked up both sides are in arguing their points. Here's what it boils down to:
Now, this discrepancy (left out feature, whatever) on the part of Apple certainly could be improved in the future. But if they didn't: it really doesn't matter because it is a dumb calculator just by its looks, and as such, falls clearly inline with number 2 in my short list above.
FWIW...
Until Panther or so, going back as far as I remember using a Mac (Finder 4.1 or something), the calculator desk accessory/app has *always* done math this way. No, it's not how many of us (even slightly) techinclined like a calc to work, but at least it's historically accurate :)
10.4: Be aware of a Calculator widget bug
" it really doesn't matter because it is a dumb calculator just by its looks"
Get the correct answer with paste
If you want the correct handling of operations, copy your calculation sequence, e.g., 1 + 2 * 3, and paste this into the widget screen (works for calculator.app as well). You will get the correct result, 7.
Get the correct answer with paste
Awesome! This is the real hint right here!
10.4: Be aware of a Calculator widget bug
I'm not replying to any one specific post because there are about 10 places where I could jump in with this, and I couldn't pick just one of them.
10.4: Be aware of a Calculator widget bug
Glad that somebody explained what I was going to say clearly. It is what it is, and that's the way it behaves. If anything, the basic mode in newer versions of Calculator.app behaves in the lessexpected manner.
10.4: Be aware of a Calculator widget bug
It is nonsense to suggest that the implied order of operations "cannot be right or wrong"  it is right, in the sense that failing to adhere to it will give you the wrong results.
People writing equations are always going to follow the rules, because there are no other alternative "conventions". If there is only one "convention", and it must be followed for accuracy, then it is not a convention at all, but a rule. If you receive the equation a + b * c, then the correct formula is a + (b * c) because the person writing the equation would have written (a + b) * c if they had meant it to be computed that way. They are not going to think "well, under a different convention, a + b * c does equal (a + b) * c, so its OK to leave it unparenthesised when what I mean is (a + b) * c". You said it yourself: "there are often competing conventions for things until a field is welldeveloped enough that a standard emerges" (my emphasis). The field of arithmetic is indeed well developed, and the implied order of operator precedence is indeed a standard. And, for reference, scientific and graphical calculators, along with programming languages, did not adopt any mathematical "conventions". They adopted a rule which was already (long, long already) a standard, and they had no choice but to do that. The notion that they arbitrarily chose from amongst a selection of possible implied orders of operation is just plain wrong. As for the calculator widget, I would not call its behaviour a bug  because the behaviour is clearly intended, and it is correctly recreating the behaviour of the device it is emulating. A calculator that can only handle dualoperand operations isn't buggy or wrong (it correctly calculates those dualoperand operations), just featurepoor.
10.4: Be aware of a Calculator widget bug
I am most of the way through a 2nd year university course that deals with defining and constructing numbers, addition, multiplication etc. Our PEMDAS convention could have easily been different (say PEASDM), in which case you would get 1+2*3=9.
10.4: Be aware of a Calculator widget bug
quote  "Whoever built the first pocket calculator established a new convention for inputting equations, which is sometimes more useful, and often less useful. This convention was established presumably because calculators originally could not handle PEMDAS"
'tsall good.
I think the solution to this is just to allow the user to flip the widget and choose which way he or she wants to use. I do think that the basic way is the correct way, but if you allow the user to choose everyone will be happy. YAY!
10.4: Be aware of a Calculator widget bug
I agree with you, its a calculator not a FORMULA solver.
10.4: Be aware of a Calculator widget bug
By the way.. check also the Help for Calculator.
10.4: Be aware of a Calculator widget bug
When I discovered many moons ago, that Google can act as a formidable scientific calculator, following the standard PEMDAS routine, I pretty much forgot about every other Calculator that existed. Try "1+2*3" in Google and you of course get the correct "7" result. Google even adds parentheses on it's results page showing how your formula should be formatted correctly, which is great for education!
Since Safari is generally running on my computer 24/7, the Google search box has pretty much become my fulltime calculator (and unit converter, spell checker, dictionary... well, CTRLCMDD plays the Dictionary role now, but I digress :P).
10.4: Be aware of a Calculator widget bug
I have to side with the "not a bug" camp on this one. The dashboard widget displays a nonscientific, fourfunction calculator.
10.4: Be aware of a Calculator widget bug
And Apple gives us the full featured calculator for people that want to the scientific approach and the widgetcalculator for nonscientific approach, makes sense to me...
Not a trivial fix + it's not a calculator, it's an adding machine
So to everyone that's whining about this, the way it behaves right now it it NOT a calculator, it's an 'adding machine', plain and simple. For everyone comparing it to $5 calculators .. they are not calculators either then, they are also adding machines. The cost of the calculator should not determine whether it obeys the laws of mathematics or not.
So here's their methods for doing the actual work, and as you can see it's not a trivial fix to make it work properly LOL
They need to rewrite a big piece of it (while they are at it they should just replace the whole thing, it's pretty messy). They should be keeping a running 'equation' in the process and not just blindly doing what they are doing above. To work like a real calculator it should evaluate this running equation at each step and report this back to the output display ... It's not rocket science (or is it? this thread makes me wonder LOL). Let's just say that whoever wrote this 'calculator' widget wouldn't make it onto my development team, paid or not!
Not a trivial fix + it's not a calculator, it's an adding machine
incidentally is it just me, or is dashboard/widget combo just a security breach waiting to happen? And I don't mean just in the malicious widget front ... I mean you are getting a lot of access here, and for some reason I suspect that there are many things that a crafty coder can take advantage of here . . .
Yes it is a trivial fix
Yes, it's a trivial fix.
I wrote this after work last night. Here you go. It works both ways and has a persistant preference to let you pick which you want. The reason it's a trivial fix is the same reason that pasting "1+2*3" calculates properly. The basic resolver is eval(display). As long as you build a string, it can resolve it.
Yes it is a trivial fix
"Trivial fix" and "Easy Fix" are 2 different things ... it was an "easy fix" because you did it correctly by keeping a running tally of the equation. I don't consider a 400 line diff trivial considering it was a 540 line javascript to start with ;) hehe .. it's all relative!
OK, it's an easy fix
Yeah, well. Calculator.js was as small as it was before because it didn't have an info button and backside and those require a lot of new functions to be copied and pasted from the documentation.
More on why it's a trivial fix
The key here isn't to change the add/sub/mult/div methods, but to intercept the keydown and add it to the display string.
This is how I handled the add key in the variant I posted. deferredEvaluation is a variable I set at startup to tell me which file to process. OpList is a list of operators that can't be entered twice (no "9++4"). The final "else" is the prior "case add" code to call function add if deferredEvaluation is false. It took me more time to work through making and saving a preference, a back, flipping the app, etc., than it did to update the JavaScript.
10.4: Be aware of a Calculator widget bug
Whatever happens, I hope that Apple doesn't make it use the orderofoperation way of doing things. When I am using a calculator that displays things the way this one does, I expect it to do things in the order I enter them. You aren't supposed to need to think about the order of operations whenever you are only doing simple calculations.
10.4: Be aware of a Calculator widget bug
"You aren't supposed to need to think about the order of operations whenever you are only doing simple calculations."
10.4: Be aware of a Calculator widget bug
Whether bug are feature, the problem is really that this is inconsistent with the way the Calculator Application works (the App gives the answer 7). The dashboard widget should work the same way. 
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors 
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. 
Visit other IDG sites: 
Created this page in 0.16 seconds 