Calculator Applet



Source code


Order of Operations

This calculator applet uses the correct order of operations (i.e. 2+5*3 = 17). Some simple, cheap calculators do not use the correct mathematical order of operations and will evaluate 2+5*3 = 21 (which is wrong!). Interestingly Microsoft Windows Calculator uses the correct order of operations in "Scientific" mode, but not in "Standard" mode. Its unclear if this was a design decision or a bug...

It seems bizarre to me that anyone would intentionally create a calculator which does not follow the correct order of operations as its a relatively simple thing to do. Doing calculations without using the order of operations is the same as pressing the "=" key after each operation. Is there any reason you'd want a calculator to do that ?? Personally I can't think of one. I think the Windows Calculator only works this way for historical reasons - i.e. many cheap calculators probably worked this way when the Calculator program was first written.