This started as a lesson for my 8-year-old nephew who is learning Director. It was a successful lesson with a somewhat satisfying result, but it didn't work like calculators we're accustomed to.
So, out of curiosity, and to get deeper into Director after many years away, I decided to give a standard calculator a shot. If I'm not there, I'm at least close. Please try it out and let me know how it works for you.
If you're intersted in the project, we can talk more about it, as well.
In Firefox 6.0 (Windows 7), the paste function (pasteClipboardInto) crashes the calculator. The alert dialog called by the "?" button also crashes the calculator. It seems to work without a problem on Internet Explorer 9.
Here's the link:
I found a problem with the "MRC" function after I posted this last night. The recalled number was going into the second position every time.
I fixed that problem and posted a new version.
The calculator works with two global variables representing the quantities in an equation, (firstNumber + secondNumber), a variable representing the operator (+-*/), and a few for setting flags.
I found another problem with my calculator by testing an equation that the Windows calculator returns a wrong answer for. My calculator didn't return the same error as the Windows calculator because I didn't write the percent function with this eventuality in mind.
To reproduce the error in the Windows calculator press: 500*5%+
It returns 12500 when the answer should be 525. The Windows calculator does the multiplication instead of changing the operator from * to + as it should.
To reproduce another error in the Windows calculator press: 9sqrt-3 (sqrt(9) - 3)
It returns 1.121252885047248e-19 when the answer should be 0.
Anyway, my calculator returns the correct answer in both cases.