Scientific Calculator
Everything past the four operations
Trigonometry, logarithms, powers, constants and memory, with a running tape you can scroll back through.
Scientific Calculator
Runs in your browser · nothing uploaded01 — How to use Scientific Calculator
02 — Getting good results
03 — Questions
No. Expressions are parsed and evaluated in this browser tab, and the tape lives in memory only — reloading the page clears it.
No, and that is deliberate. Passing typed text to eval executes arbitrary JavaScript, which is a real hole in a page that also hosts other tools. This tokenises the expression, converts it to reverse Polish notation and evaluates that, so only the functions and operators it defines can ever run.
Because binary floating point cannot represent 0.1 or 0.2 exactly, so their sum lands a fraction above 0.3. Every calculator built on standard floating point has this behaviour; the display trims the artefact rather than showing 0.30000000000000004.
About 15 significant digits, which is what a double-precision float holds. Results are shown to ten significant figures by default because digits beyond that are usually accumulated rounding rather than signal.
04 — More about Scientific Calculator
Why this parses instead of evaluating
The quickest way to build a calculator on the web is to hand the typed string to eval or the Function constructor and show what comes back. It works immediately, handles precedence and brackets for free, and is a genuinely bad idea. Anything typed becomes executable code with full access to the page, which turns a calculator into an injection point for any content that can influence what gets typed. It also gives no control over the things a calculator actually needs: degrees mode is impossible, error messages come out as JavaScript exceptions rather than explanations, and the entire JavaScript standard library is reachable when only twenty-odd mathematical functions should be. A proper parser is perhaps two hundred lines — tokenise, shunting-yard to reverse Polish, evaluate the stack — and every one of those problems disappears.
Precedence, associativity, and the two rules that catch everyone
Operator precedence decides which of two different operators binds first: multiplication before addition, so 2+3*4 is 14. Associativity decides which way a run of the same operator groups, and it is where the surprises live. Exponentiation is right-associative — 2^3^2 groups as 2^(3^2) — while subtraction and division are left-associative, so 10-3-2 is 5 rather than 9. The second trap is unary minus. It sits below exponentiation in precedence, which makes -2^2 equal -4: the square happens, then the sign. Both rules are standard mathematical convention and both regularly produce bug reports, because the alternative reading is equally natural to a human eye. Calculators that get them wrong are common enough that checking these two expressions is a reasonable way to test one.
61 more tools
where this came from.
Same shell, same shortcuts, same promise: nothing leaves your browser.