Skip to content

Scientific Calculator: Powers, Roots, Logs and Trig

Online scientific calculator with powers, roots, log and ln, sine, cosine and tangent in degrees or radians, factorials, percent and memory.

Scientific Calculator

Evaluates a typed or tapped expression with the usual order of operations, including powers, roots, logarithms, trigonometry and factorials.

Use + - * / for arithmetic, ^ for powers, ! for factorial and % for percent.

Type an expression or use the keypad to see a result.

Keypad

How this calculator reads an expression

Percent divides by 100 wherever it appears, so 100+10% is 100.1, not 110. Powers group from the right: 2^3^2 is 2^9, which is 512. A minus sign in front of a power is applied last, so -2^2 is -4. Two things written side by side are multiplied, and that multiplication ranks with division, so both are read left to right: 1/2pi means (1/2) times pi, and 6/2(1+2) is 9. Some scientific calculators read 1/2pi the other way, as 1/(2 times pi), so use brackets when the meaning matters. In Degrees mode the tangent is refused at 90 degrees and every odd multiple of it, because it has no value there.

History

No calculations yet. Press = to add one.

Loading calculator...
📚

Documentation

Scientific Calculator

A scientific calculator works out the value of a written mathematical expression. This one reads powers, roots, logarithms, trigonometry, factorials and percentages, applies the standard order of operations, and reports one answer.

What the calculator does

An expression is typed into the Expression box or built with the keypad. The calculator reads it as soon as it changes, so no equals key is needed to see the answer. The = key adds the calculation to a history list instead.

It accepts:

  • the digits, a decimal point, and numbers in exponent form such as 1.5e-3;
  • the operators +, -, *, / and ^ (power), plus brackets;
  • the constants pi and e;
  • the functions sin, cos, tan, asin, acos, atan, log, ln, sqrt and cbrt;
  • the postfix signs ! (factorial) and % (percent).

Keypad glyphs are translated to their plain equivalents, so ×, ÷, and π mean the same as *, /, - and pi.

log is the base 10 logarithm and ln is the natural logarithm, base e. That is the labelling used on TI and Casio scientific calculators, and the naming in the NIST Digital Library of Mathematical Functions, section 4.2.

The order of operations

The rule that decides what an expression means is the order of operations. This calculator uses the grammar below. Each line calls the line under it, so the nesting is the precedence table: the last line binds tightest and is worked out first.

1expression := term (('+' | '-') term)*
2term       := unary (('*' | '/' | juxtaposition) unary)*
3unary      := ('-' | '+') unary | power
4power      := postfix ('^' unary)?
5postfix    := primary ('!' | '%')*
6primary    := number | constant | name '(' expression ')' | '(' expression ')'
7

Written as a list, from first worked out to last:

  1. anything inside brackets, and a function applied to brackets;
  2. ! and %;
  3. ^;
  4. a leading - or + sign;
  5. *, /, and two things written side by side;
  6. + and -.

The conventions this produces match ISO 80000-2:2019 and the article "Order of operations" on Wikipedia:

WrittenReads asValue
2^3^22^(3^2)512
-2^2-(2^2)-4
2^-22^(-2)0.25
2^3!2^(3!)64
100+10%100 + (10/100)100.1
1/2pi(1/2) * pi1.57079632679
6/2(1+2)(6/2) * (1+2)9

Two numbers or names written side by side are multiplied, which is what makes 2pi, 2(3+4) and 3sin(30) work. That hidden multiplication ranks with * and /, so a juxtaposition and a division are read from left to right. Many handheld scientific calculators bind a juxtaposition tighter than division and read 1/2pi as 1/(2*pi), which is a different answer. Wikipedia describes the split in "Calculator input methods". Brackets settle any case where the difference matters.

% divides by 100 wherever it sits. So 20% is 0.2 and 200*15% is 30. It is not the "percent of the running total" key of a shop till, and it is not a remainder operator.

Worked example

The expression sin(30)+2^3*ln(4), in Degrees mode, is worked out in this order:

  1. sin(30) is 0.5, because 30 degrees is half a right angle and its sine is one half.
  2. 2^3 is 8. Powers come before multiplication.
  3. ln(4) is 1.38629436112.
  4. 8 * 1.38629436112 is 11.090354889.
  5. 0.5 + 11.090354889 is 11.590354889.

The calculator shows 11.590354889.

A second example shows the left to right rule. In 6/2(1+2) the bracket is worked out first, giving 6/2*3. The division and the hidden multiplication have the same rank, so the division goes first: 6/2 is 3, and 3*3 is 9.

Degrees and radians

The Angle unit setting decides how sin, cos and tan read their input, and what unit asin, acos and atan return. In Degrees mode a full turn is 360. In Radians mode a full turn is 2pi, about 6.28318530718. The same expression can give very different answers in the two modes: sin(30) is 0.5 in Degrees mode and -0.988031624093 in Radians mode.

How numbers are stored and shown

Every value is an IEEE 754 binary64 double, the number type described in ECMA-262, the ECMAScript Language Specification, section 6.1.6.1. A double holds about 15 to 17 decimal digits. The answer is rounded once, for the screen only, to 12 significant digits. Values below 0.000001 or at or above 1,000,000,000,000 are shown in exponent form, so 0.0000001 reads as 1E-7.

The stored number keeps full precision. Memory stores the exact result, not the 12 digits on screen, and MR pastes back the shortest text that reads as that same number. A negative memory value is pasted in brackets, so recalling it after a 2 reads as a multiplication rather than a subtraction.

Rounding is never used to decide anything. A tiny leftover from earlier arithmetic is a real number and is treated as one. 0.1*3-0.3 is not zero in binary; it is about 5.55111512313E-17, so 5/(0.1*3-0.3) gives 9.00719925474E16 rather than a divide-by-zero message.

For the same reason sin(180) in Degrees mode shows 1.22464679915E-16 and not 0. The error there is around one part in ten thousand million million, and it stays that small. The tangent is the exception, and it is handled below.

What the calculator refuses

The calculator shows a message instead of an answer when:

  • a denominator is exactly zero, including a written number too small for a double, such as 1e-400, which is already zero once read;
  • sqrt is given a negative number;
  • log or ln is given a number that is not greater than zero;
  • asin or acos is given a number outside -1 to 1, the domain given in NIST DLMF section 4.14;
  • tan is used at 90 degrees, or any odd multiple of it, where it has no value;
  • a factorial is asked of anything but a whole number from 0 to 170;
  • a number carries a second decimal point, as in 1.2.3;
  • the expression is longer than 512 characters.

The 170 limit is a property of the number type, not a preference: 170 factorial is about 7.25741561531E306, which still fits a double, while 171 factorial does not. The 512 character limit is checked in code, because the length of the expression is what decides how much work the calculator does.

The tangent check rounds the angle to 9 decimal places before testing it. That folds drift from earlier arithmetic back onto the exact asymptote, at the cost of a refusal window about 5e-10 degrees wide on each side. tan(89.9999999994) returns 95,493,592,025, and tan(89.9999999995) is refused. Radians mode does no such check, because a typed radian value near half of pi is just another number with no special status.

Frequently asked questions

What does the % key do here? It divides by 100 wherever it appears. 100+10% is 100.1, because it means 100 plus 0.1. It does not take a percentage of whatever came before it.

Is 2^3^2 64 or 512? 512. Powers group from the right, so it means 2^(3^2), which is 2^9. This follows ISO 80000-2:2019.

Why is 6/2(1+2) 9 and not 1? A hidden multiplication has the same rank as a division, and equal ranks are read from left to right. Calculators that bind juxtaposition tighter answer 1. Brackets remove the doubt.

Why does sin(180) not show 0? Because 180 degrees is converted to radians first, and pi cannot be written exactly in binary. The answer is about 1.2e-16, which is the true value of the sine of the number the machine actually used.

What is the difference between log and ln? log is base 10, so log(1000) is 3. ln is base e, so ln(e) is 1. The keypad labels follow the same convention as TI and Casio scientific calculators.

Why is a factorial above 170 refused? 171 factorial is larger than any number a double can hold, so the answer would be infinity rather than a number. The calculator says so instead of showing a meaningless result.

Sources

  • IEEE 754-2019, IEEE Standard for Floating-Point Arithmetic.
  • ECMA-262, ECMAScript Language Specification, section 6.1.6.1, "The Number Type".
  • ISO 80000-2:2019, Quantities and units, Part 2: Mathematical signs and symbols.
  • NIST Digital Library of Mathematical Functions, sections 4.2 and 4.14.
  • Wikipedia, "Order of operations".
  • Wikipedia, "Calculator input methods".