| Return to calculator
Calculator Differences About Rolf's Calculator This calculator was written using JavaScript by Rolf Howarth, 4 March 1996. To switch from scientific to logical display press the 'HEX' key. To switch back to scientific mode press the 'DEC' key twice. |
| I wrote the author of the calculator: The only problem I have found with this awesome JavaScript is a cosine display error: cos 90o = 0, NOT |
| The problem is just one of accuracy and display, it's
not a 'bug'. The result given (6e-17) pretty much IS zero, to 16 decimal places!
(Mathematically, trig functions are actually defined and calculated in terms of radians,
so I suspect the problem is that 90 degrees or pi/2 is irrational and doesn't have an
exact representation in computer notation, hence the inaccuracy). -Rolf Howarth |
| This makes sense.
This is indeed a very small number and when rounded even to the nearest 1/10 000 000 it is still equal to zero!! |
This applet illustrates several JavaScript features:
A fully featured scientific calculator is implemented, including trig functions and logarithms, factorials, 12 levels of parentheses, logs to base 2 (one of my favourite functions!), bitwise logical operators, hex, octal, binary and ascii display. (Warning: you may occasionally notice strange results in the Windows version due to problems with its floating point implementation.)
|