Solve ax^2 + bx + c = 0 with an exact discriminant, giving exact rational roots where they exist and complex roots where they do not.
Scientific Calculator
Evaluate an expression with exact fraction arithmetic, trigonometry, logarithms and factorials, reporting whether the result is exact.
- Free
- No sign-up
- Runs in your browser
Input
Operators + - * / ^ % ! and brackets. Functions: sqrt, cbrt, root, ln, log, log2, logb, exp, sin, cos, tan, asin, acos, atan, abs, floor, ceil, round, min, max, gcd, lcm. Constants: pi, e.
sin(90) is 1 in degrees and about 0.894 in radians, so this matters.
How many digits to show when the answer is irrational. An exact answer ignores this.
Banker’s rounding; the IEEE default
Try an example
Ready
Everything happens on this device. No upload, no account, no network request.
How to use this tool
- 1
Type an expression and the result appears with a note on whether it is exact.
- 2
Arithmetic stays in exact fractions until an irrational function is applied, so 1/3 + 1/3 + 1/3 is exactly 1.
- 3
Set the angle mode before using a trigonometric function.
Questions about Scientific Calculator
Does this use eval?
No. The expression is tokenised and parsed by a recursive-descent parser written for this purpose. Nothing you type can run as code - `constructor`, `alert(1)` and `require("fs")` are all just syntax errors. Putting an evaluator behind a public input box is a well-understood way to create a vulnerability, and the parser is faster than eval at this size anyway.
Why does this say the answer is exact?
Because it is. The arithmetic runs on exact fractions over arbitrary-precision integers, not floating-point numbers, so 1/3 + 1/3 + 1/3 is exactly 1 rather than 0.9999999999999999, and there is no rounding anywhere in the calculation. Where a result genuinely cannot be written exactly - a square root, a logarithm, anything involving pi - the page says so and gives a stated number of correct digits instead.
Why is sin(90) in degrees reported as approximate when it is exactly 1?
Because of how it was computed, not what it equals. Converting 90 degrees to radians gives pi/2, and pi is irrational, so the sine is evaluated on an approximation. The answer rounds to exactly 1 at every precision you can ask for, but the calculation genuinely involved an approximation and the page says so rather than claiming a certainty it did not establish.
What does -2^2 give?
-4. Exponentiation binds more tightly than the minus sign, so this reads as -(2^2), which is the standard convention and what a scientific calculator gives. Write (-2)^2 for 4. Similarly 2^3^2 is 512, because exponentiation is right-associative: it means 2^(3^2).
Which remainder convention does % use?
Truncated toward zero, so -7 % 3 is -1. That matches C, Java and JavaScript. Python takes the sign of the divisor instead and gives 2. Neither is wrong; they are different conventions, and this one is stated so you can tell which you have.
Is my data sent anywhere?
No. This runs as JavaScript in your browser tab: there is no network request carrying your numbers, nothing reaches a server log, and it keeps working with your connection off. You can confirm it in the browser’s network panel.
Related tools
Other tools you might reach for next.
Solve ax + b = c exactly, with the working shown, and distinguish an identity from a contradiction when a is zero.
Solve a pair of simultaneous linear equations exactly by Cramer's rule, distinguishing no solution from infinitely many.
Reduce a fraction to lowest terms, with its mixed number and exact decimal form including any repeating block.
Add two fractions exactly, showing the common denominator step and reducing the result.
Subtract one fraction from another exactly, showing the common denominator step.
Multiply two fractions exactly, multiplying across and reducing the result.
Divide one fraction by another exactly, by multiplying by the reciprocal.