CruxDevCruxDev Tools Prompts
finance Utility • Zero-Server Privacy • 100% Client-Side

Scientific Calculator

Full expression calculator with trig, logs, powers, constants, and degree/radian modes plus a session history.

Overview

An expression-based scientific calculator that evaluates a whole line of math at once — trigonometry, logarithms, powers, and constants — with a degree/radian switch and a running history. You type or build an expression such as sqrt(16) + sin(30) * 2^3 and press Enter, instead of tapping a chain of buttons one operator at a time.

How It Works

Type an expression into the input field, or tap the keypad buttons to insert sin(, cos(, tan(, log(, ln(, sqrt(, abs(, the constants pi and e, and the digits and operators. Choose Degrees or Radians, then press = or Enter to evaluate. The result replaces the input so you can continue calculating, and the last 20 expressions stay in a clickable history list — clicking an entry loads its result back into the input for the next step.

Step-by-Step Usage Guide

  1. Type an expression or use the keypad to insert functions and constants.
  2. Switch between Degrees and Radians depending on your trig input.
  3. Press Enter or = to evaluate.
  4. Click any history line to reuse a previous result as your next starting value.

Technical Specifications & Standards

The evaluator is a hand-written tokenizer plus shunting-yard parser that runs entirely in the browser — no eval() and no server call. It handles operator precedence (plus and minus lowest, then multiplication, division, and modulo, then exponentiation), unary minus, and right-associative powers, so 2^3^2 evaluates as 2^(3^2) = 512, matching mathematical convention. In degree mode the trig functions convert their argument with a π/180 factor and the inverse functions convert back; log is base-10 (log10) while ln is the natural logarithm, the split most scientific calculators use. Results are rounded to 12 significant digits to hide floating-point noise like 0.9999999999 appearing for sin of a clean input. Two things to know: the % key is the programming-style modulo operator (10 % 3 = 1), not a percent-of function, and mismatched parentheses produce a clear error rather than a guess. History lives in component state only and clears on refresh.

Targeted Use Cases

  • Checking homework steps that mix powers, roots, and trig functions.
  • Converting an angle calculation between degrees and radians instantly.
  • Chaining multi-step calculations by reusing results from the history list.
  • Quick engineering estimates like a square root of a sum or a base-10 logarithm.

Notes & Gotchas

  • Match the angle mode to your data before evaluating trig functions.
  • Use log for base-10 and ln for natural logarithms; they are different keys here.
  • Remember % means modulo, so write 25/100*80 style arithmetic for percent problems.
  • Parentheses are free — add them liberally to make precedence explicit.

Frequently Asked Questions

Does the calculator send my expressions to a server?

No. The expression is parsed and evaluated entirely in your browser by a self-contained tokenizer and shunting-yard engine. Nothing is transmitted, and history disappears when you reload the page.

What is the difference between log and ln here?

log computes the base-10 logarithm and ln computes the natural logarithm. This matches the labelling on standard scientific calculators, where the two keys are distinct.

How are angles handled?

In Degrees mode sin, cos, and tan interpret their argument as degrees, and the inverse functions return degrees. In Radians mode no conversion is applied. The toggle sits next to the = button.

Why is % behaving like modulo instead of percent?

The % operator in this evaluator is the modulo operation, returning the remainder of division, so 10 % 3 equals 1. To compute percentages, write the arithmetic out, for example 200 * 15 / 100.