A scientific calculator is more than a bigger keypad — it understands the rules of mathematics, from operator precedence to angle modes. This guide explains how this tool parses what you type, why trig answers depend on degrees versus radians, when to reach for ln instead of log, and how factorials and permutations actually work.

How expressions are parsed (no eval, ever)

Rather than executing your input as code, this calculator tokenizes the expression, converts it to Reverse Polish Notation with the shunting-yard algorithm, and evaluates that stack. The practical upshot is correct order of operations every time: exponents before multiplication, multiplication before addition, and right-associative powers so 2^3^2 = 512. Parentheses override the defaults, and the = key stays disabled until your parentheses balance — a built-in guard against the most common typo.

Implicit multiplication is supported, so , 3(4+1), and 2sin(45) all work without an explicit × sign.

Degrees, radians, and gradians

Trigonometric functions need to know what unit your angle is in. In DEG mode a right angle is 90; in RAD mode it is π/2 ≈ 1.5708; in GRAD mode it is 100. Internally every angle is converted to radians before the sine, cosine, or tangent is computed, and inverse functions convert the radian answer back to your selected mode. If a trig result ever looks wildly wrong, the angle mode is the first thing to check — sin(90) is 1 in degrees but 0.894 in radians.

ln versus log, and the change of base

ln is the natural logarithm (base e ≈ 2.71828), the inverse of eˣ, and the one that shows up in growth, decay, and calculus. log here is base 10, handy for orders of magnitude, decibels, and pH. For any other base, use logᵧ(value, base) — for example logᵧ(8, 2) = 3. Under the hood it applies the change-of-base identity logᵧ(x) = ln(x)/ln(y).

Factorials, permutations, and combinations

The factorial key (x!) multiplies every whole number down to 1 and is defined only for non-negative integers, so −3! or 2.5! returns a Math Error. nPr counts ordered arrangements and nCr counts unordered selections; both require whole numbers with 0 ≤ r ≤ n. Because factorials grow explosively, 171! overflows the range of a double-precision number and the calculator reports a Math Error rather than a misleading Infinity.

Memory, Ans, and the history tape

Five memory keys (MC, MR, M+, M−, MS) let you accumulate a side total while you work, and the M badge lights up whenever memory holds a value. Ans reuses your last result, and pressing an operator right after = automatically chains from the previous answer. Every evaluation is logged to the history tape, which you can click to reuse, copy, or export to CSV — and it persists in your browser between sessions.

Edge cases and error handling

The calculator returns a clear Math Error instead of a silent wrong answer for division by zero, √ of a negative, ln or log of a non-positive number, asin/acos outside [−1, 1], factorials of negatives or fractions, and overflow. Unbalanced parentheses simply keep the = key disabled until you close them. This fail-loud behavior is deliberate: a calculator that quietly produces NaN or Infinity is worse than one that tells you what went wrong.