Scientific Calculator
A full scientific calculator with trigonometry, logarithms, powers, roots and constants, running entirely in your browser with a visible expression history.
Degree mode cannot give you an exact zero
The obvious explanation is that converting degrees to radians loses something. It does not — for every angle below, multiplying by the ratio and dividing by 180 lands exactly on the nearest representable value. The arithmetic is as good as it can be.
| Angle | sine | cosine |
|---|---|---|
| 0° | 0 | 1 |
| 30° | 0.5 | 0.866025403784 |
| 45° | 0.707106781187 | 0.707106781187 |
| 90° | 1 | 6.123e-17 |
| 180° | 1.225e-16 | -1 |
| 270° | -1 | -1.837e-16 |
| 360° | -2.449e-16 | 1 |
The problem is one step earlier. The ratio of a circle to its diameter is irrational, so what a machine holds is the nearest value it can represent. Ask for the sine of that and you get the sine of something very slightly short of a half-turn — 4 of the values above that ought to be zero are not, and one of them is negative, which is the giveaway. All 5 conversions checked land exactly where they should.
The 180° figure is worth staring at. Near a half-turn the sine of an angle is very close to how far that angle is from a half-turn — so 1.225e-16 is not merely caused by the representation error, it is that error, printed out. The 360° figure is exactly twice it with a sign, because the error doubles along with the angle.
sin(0°) is the one exact value, because zero times anything is zero. Even the ones that look clean are not: sin(30°) comes out as 0.49999999999999994, a single unit in the last place short of a half. It prints as 0.5 only because the display rounds it.
And tan(90°) is a large number rather than an error
tan(90°) is undefined. What comes out is 1.633e+16, because the angle handed in is very slightly not a right angle, and the tangent of very-slightly-not is very large rather than undefined.
| Angle | tangent |
|---|---|
| 0° | 0 |
| 45° | 1 |
| 89° | 57.2899616308 |
| 90° | 1.633e+16 |
| 91° | -57.2899616308 |
| 270° | 5.444e+15 |
A calculator that printed a word there would have to recognise the input rather than compute it. This one prints what it got, which is at least honest about what happened — an enormous result means you asked for a vertical line.
Two limits worth knowing before you trust a result
Factorials here are computed in double precision, which holds whole numbers exactly up to 9,007,199,254,740,991 and then starts rounding. 23! is the first that comes back wrong — later than that limit suggests, because a factorial gathers factors of two and the low bits it would lose are zeros.
| Computed here | Exact value | |
|---|---|---|
| 20! | 2432902008176640000 | the same |
| 21! | 51090942171709440000 | the same |
| 22! | 1124000727777607680000 | the same |
| 23! | 25852016738884978212864 | 25852016738884976640000 |
| 25! | 155112100433309860553031… | 155112100433309859840000… |
| 170! | 725741561530799404539963… | 725741561530799896739672… |
| 171! | infinity | 124101807021766782342484… |
From 171! the answer is infinity, which is at least visible. Between 23 and 170 it is merely wrong. The combinations page on this site uses arbitrary-precision integers and has neither limit.
The second limit was a bug, and is fixed. Numbers were read as digits-and-dots
and then converted with a function that stops at the first thing it does not
understand — so 1.2.3 was swallowed whole and became 1.2, and
1.2.3 + 1 quietly evaluated to 2.2.
| Typed | Was read as | Now |
|---|---|---|
1.2 | 1.2 | 1.2 |
3. | 3 | 3 |
.5 | 0.5 | 0.5 |
1.2e3 | 1200 | 1200 |
1.2.3 | 1.2 | rejected |
1..2 | 1 | rejected |
0.5.0.5 | 0.5 | rejected |
3 of the 7 were malformed and every one
was accepted as a shorter number, with nothing reported — because nothing
failed. The conversion succeeded on a prefix of what it was given. Numbers are
now checked as a whole, which still accepts 3., .5 and
1.2e3.
How to use
- Type or click your expression.
- Check the degree and radian setting before using trigonometry.
- Read the result and the history of what you entered.
- Use parentheses rather than relying on precedence.
Frequently asked questions
Why does my trigonometry give a strange answer?
Almost always the angle mode. The sine of 30 is 0.5 in degrees and about minus 0.988 in radians, and both are correct for their mode. Checking the mode before trusting a trig result saves a great deal of confusion, and this is the single most common calculator error.
What order does it apply operations in?
The standard convention: parentheses, then exponents, then multiplication and division left to right, then addition and subtraction. Where an expression could be read more than one way, adding parentheses is better than hoping — famously ambiguous expressions circulate online precisely because the convention does not settle every case.
What is the difference between log and ln?
The base. Log conventionally means base 10 and ln means base e, roughly 2.718. Some contexts, particularly computer science, use log to mean base 2, so the meaning depends on the field. Natural logarithms appear throughout calculus because their derivative is uniquely simple.
Why does 0.1 plus 0.2 not give exactly 0.3?
Because binary floating-point cannot represent 0.1 or 0.2 exactly, any more than decimal can represent one third. The tiny representation errors survive the addition and show up in the last digits. It is not a bug in the calculator but a property of how computers store fractional numbers.
What is the difference between minus and negative?
Subtraction takes two operands; negation takes one. Most calculators distinguish them, and mixing them up produces syntax errors or wrong signs, particularly when negating a value before raising it to a power — negative three squared is nine, but minus three squared is conventionally minus nine.
Does anything I type get sent anywhere?
No. All the arithmetic runs in your browser, and nothing is recorded or transmitted. The history exists only in the page and disappears when you close it.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.