Calculator
This is a JavaScript variant if Steinar Foss' expression interpreter. A DOS program, based on this algorithm (MA, 23K), as well as C (9K) and QBasic (8K) sources of this algorithm are also available. This script is listed with ScriptSearch.
The simplest way to use this program is to enter a mathematical expression in the first text-box, press on 'Calculate' and read the answer in the text-box below. The following mathematical functions are supported: 'SIN' - sine, 'COS' - cosine, 'TAN' - tangent, 'ATAN' or 'ATN' - arc tangent, 'SQRT' or 'SQR' - Root, 'LOG' - nLogarithm, 'EXP' - exponent, 'ABS' - absolute, 'PI' - Pi. You can use up to 150 nested parenthesis. Unrecognised characters and spaces will be ignored. Negative numbers should preferably be entered in parenthesis: (-85)
The program also accepts alternative, short commands (S, C, T, N, R, L, e, A, P). For example, to calculate ABS(SIN(5) + (4 * 0.0007) - TAN(6 ^ 2))
, you can alternatively enter A(S5+(4*7E-4)-T(6^2))
.
Trigonometric functions use radians. To convert degrees to radians, multiply the degrees by PI/180
. To convert from radians to degrees, multiply the radians by 180/PI
.
Numbers in scientific format should be entered in the following fashion (the algorithm is case sensitive):
[+/-]12345E[+/-]123 | (-0.007) = (-7E-3) | 7000000 = 7E6
This page has been visited times, plus 38 earlier visits.