🧰 UtlKit

How to Use the Scientific Calculator: Sin, Cos, Tan, Log, Power and Factorial from the Button-Only Keypad, in the Browser

One expression line, entered entirely with the 33-key on-screen keypad in DEG or RAD mode, evaluates trig, inverse trig, base-10 and natural log, square root, absolute value, power and integer factorial, all computed in the browser.

The Scientific Calculator is a button-only expression evaluator: there is no text field and no keyboard capture, and every token in the expression line comes from the 33-key keypad — the ten digits, a decimal point, the five operators plus, minus, times, divide and power, the constants π and e, ten function buttons, a factorial, a parenthesis key, clear, backspace and equals. The page loads in DEG mode. Pressing equals rewrites the line to the result, so an answer feeds straight into the next operation. Every value is computed in the browser from the Math object, with no backend and no API call. Start at the Scientific Calculator, keep DEG selected, and press sin, ( ), 4, 5, ( ), =: the line reads 0.7071067812.

The keypad

The 33 keys sit in a five-column grid. The top three rows carry the functions and the editing keys: sin, cos, tan, π and clear; asin, acos, atan, backspace and the ( ) key; log, ln, sqrt, x! and equals. The bottom four rows carry the digits and the operators: 7 8 9 with divide and power, 4 5 6 with times and the e constant, 1 2 3 with minus and plus, and a final row of 0, the decimal point and abs. The x! key is labelled with an x, but it inserts only the ! mark, and that mark binds to the whole number typed before it: 5, x!, = prints 120. The ( ) key is the only source of parentheses, and it inserts one balanced bracket at a time rather than a pair — it opens a group when the line is balanced, and it closes one when the argument in front of it is complete, so a function call and its nesting are enterable from the keypad alone.

DEG and RAD

The toggle button reads DEG when the page loads, and the mode changes two things at once. The three direct functions read their argument in degrees: sin(45) is 0.7071067812, cos(60) is 0.5 and tan(45) is 1. In RAD mode the same three calls read the argument as radians, and sin(45) becomes 0.8509035245. The three inverse functions print their result in the matching unit: asin(1) is 90 in DEG and 1.5707963268 in RAD, and atan(1) is 45 in DEG. Toggling the mode does not rewrite the line; it changes how the next equals reads it, so the same sin(45) line evaluates to two different numbers under the two modes.

Which log is which

The log button is base ten and the ln button is natural. log(100) prints 2, because 10 to the power 2 is 100, and ln(e) prints 1, because the e constant and the natural log are inverses of each other. There is no base selector: a base-2 logarithm has to be built from the two that exist, as log(x) divided by log(2).

Power, constants and factorial

The ^ key is the power operator. 2, ^, 1, 0, = prints 1024, and because the printed result becomes the new line, continuing with ^, 2, = prints 1048576. The π key alone prints 3.1415926536, and 2, ×, π, = prints 6.2831853072, because non-integer results are trimmed to ten decimals. The e key is Euler's number, 2.7182818285. Factorial is integer only: 5! is 120, 0! is 1, 17! is 355687428096000 and 20! is 2432902008176640000; 100! overflows the range that prints as a plain integer and comes out in scientific notation as 9.33262154439441e+157.

Grouping and nested calls

Because the ( ) key inserts one bracket at a time, sin of 45 enters as sin, ( ), 4, 5, ( ), and a nested call enters the same way from the inside out: sin of cos of 0 is sin, ( ), cos, ( ), 0, ( ), ( ), where the press after the 0 closes the inner cos and the next press closes the outer sin. In DEG mode the nested line evaluates to 0.0174524064. Grouping controls precedence exactly as on paper: ( ), 1, +, 2, ( ), ×, 3 prints 9, while the ungrouped 1, +, 2, ×, 3 prints 7.

Results and the invalid line

Equals prints integers as plain integers and trims every other result to ten decimals: 1÷3 prints 0.3333333333, 0.1+0.2 prints 0.3 and sqrt(2) prints 1.4142135624. The printed string, not the full-precision value, becomes the line that the next operation reads, so the trim can show: after 1÷3, pressing ×, 3, = prints 0.9999999999, and after sqrt(2), pressing ^, 2, = prints 2.0000000001. A line that cannot evaluate raises the invalid expression error in the page language, and the line stays on the display for correction: 1÷0, asin(2), (-1)^0.5 and 2.5! all raise it, and so does 2π, because the evaluator has no implicit multiplication and the × key has to be pressed between the number and the constant.

The float corners

tan(90) in DEG mode does not raise an error: it prints 16331239353195370. The degree-to-radian conversion of 90 lands a hair short of the exact π/2 in floating point, where the tangent is undefined, so the sine over the cosine returns a large finite value instead of failing. A whole number past fifteen digits loses its tail: 123456789123456789 enters as 123456789123456780, because the expression string carries all nineteen digits, but the evaluation parses it to a 64-bit float, which keeps only about fifteen.

What it is not

The Scientific Calculator is not a percentage tool: for the share of a number in both directions, the Percentage Calculator runs that computation, and the percentage guide covers the increase and decrease questions. It is not a discount calculator either: for the marked-down price and the savings, the Discount Calculator does that arithmetic. And it keeps no state beyond the line: there are no memory keys, no history, no stored results and no constant repeat, and the clear key wipes the line, the result and the error at once.

Related Tools

Frequently Asked Questions

Does the Scientific Calculator call any API or server?

No. The expression line is rewritten into browser Math calls — the trig functions with the degree conversion applied in DEG mode, log and ln to the base-10 and natural log, and the factorial to a loop over the integer — and evaluated on the page. The DEG/RAD toggle only changes how the next evaluation reads the line. Nothing you press leaves the page.

Why does the same line, sin(45), give two different answers?

Because the DEG/RAD mode changes how the argument is read. In DEG mode the 45 is converted to radians before the sine is taken, and sin(45) is 0.7071067812; in RAD mode the 45 is already the angle in radians, and the result is 0.8509035245. The inverse functions flip with the mode: asin(1) prints 90 in DEG and 1.5707963268 in RAD.

Why does log mean base ten instead of the natural log?

It is a deliberate split: log is base ten, so log(100) is 2, and ln is natural, so ln(e) is 1. There is no base selector on the keypad, so a base-2 logarithm is built from the two that exist, as log(x) divided by log(2).

Why does 2.5! raise an error while 5! prints 120?

The factorial key matches only a whole number in front of the ! mark, so 5! is 120, 0! is 1 and 17! is 355687428096000, but a decimal such as 2.5 never forms a factorial call and the line fails to evaluate. There is no gamma-function extension for fractional inputs.

Why does tan(90) print a huge number instead of an error?

Because the conversion of 90 degrees to radians lands a hair short of the exact π/2 in floating point, where the tangent is undefined, so the function returns a large finite value, 16331239353195370, instead of failing. The invalid expression error is reserved for values the evaluator cannot produce at all: 1÷0, asin(2) and (-1)^0.5.

Related Articles