Home › Math › Scientific Calculator
🔧

Scientific Calculator

Expression calculator with powers, factorials, trig, logs, DEG/RAD, Ans memory and batch evaluation

① 表达式求值

三个约定:「%」就是把数字除以 100,所以 200×10% = 20,要「涨 10%」请写 200*(1+10%);相邻的量会自动相乘,2pi、3(4+1)、(2)(3) 都能算;函数括号可省,sin30 等同于 sin(30)。数字里的千分位逗号可用,如 1,000/8。

② 历史记录(点击任意一条可回到输入框)
还没有计算记录,算一次就会出现在这里
③ 一批表达式一起算

批量计算沿用 ① 里的角度单位与保留位数设置;Ans 在批量模式下取上一次单条计算的结果。每行必须是完整表达式,不能只写运算符。

About this tool

A basic calculator cannot evaluate 12!/(5!*7!), and running eval on user input is not acceptable. This tool tokenises the expression, converts it to postfix and evaluates it, so you get exactly what you typed, with every rule stated:

  • Full expressions: arithmetic, parentheses, powers, factorials, percentages and remainders can be mixed; 2+3*4 is 14, (2+3)*4 is 20 and (2+3)*sqrt(16)/2^3 is 2.5
  • Scientific and engineering forms: 1e3+1 is 1001, 2E-2 is 0.02 and 1,000,000/8/7 understands thousands separators and gives 17857.1428571
  • Optional parentheses and multiplication signs: 2pi is 6.28318530718, 3(4+1) is 15, sin30 equals sin(30), √9 is 3 and ∛(-27) is -3
  • DEG and RAD: in degrees sin(30) is 0.5 and acos(0.5) is 60; in radians sin(30) is -0.988031624093, and inverse trig output follows the mode
  • Several views of the result: grouped form, full double-precision value, scientific notation, integer part, decimal places, three rounding modes and a reduced fraction approximation
  • Ans and memory: Ans recalls the last result, MS stores, MR recalls and MC clears; continuing from the previous answer is one click
  • History: the last 20 expressions and results, and clicking one loads it back for editing
  • Batch evaluation: one expression per line; a bad line does not stop the others and its error is shown beside it
  • Explained errors: unclosed parentheses report how many closing brackets are missing, and 1/0, √-4, ln(0), tan(90), 171! and (-8)^0.5 each get a specific message

When to use it

  • Write a long calculation in one line, such as a combination, a geometric series sum or a compound interest total that chained key presses cannot handle
  • Check a formula by hand and verify it without precedence mistakes
  • Evaluate a pasted column of expressions from a spreadsheet or notes
  • Teach right-associative powers, the precedence of unary minus and roots, and the difference between degrees and radians
  • Engineering and statistics with hyperbolic functions, base-2 logs, remainders and factorials

Supported syntax

InputMeaningResult
2+3*4Multiplication first14
2^10 and 2**10Power, both spellings1024
2^3^2Right-associative, so 3^2 first512, not 64
-2^2Power binds tighter than unary minus-4; write (-2)^2 for 4
5! and fact(5)Factorial120
10% and 200*(1+10%)Percent means divide by 1000.1 and 220
100 mod 7Remainder2
12!/(5!*7!)Combination written directly792
3(4+1), 2pi, (2)(3)Adjacent values multiply15, 6.28318530718, 6
1,000/8Thousands separator125
sin30 + 1A function without brackets takes only the next value1.5, not sin(31)
ans*2Recall the last result42 when the last answer was 21

Precedence, highest first

  • Parentheses ( ): the direct way to change precedence; unclosed brackets report how many are missing
  • Postfix ! %: bound to the preceding value, so 2^3! is 2^6 = 64
  • Power ^: right-associative and tighter than unary minus
  • Unary signs -3 +5: can repeat, so 3 - -2 is 5
  • Multiply, divide, remainder * / mod: includes implicit multiplication and is left-associative
  • Add and subtract + -: lowest, left-associative, so 100-20-30 is 50

Functions and constants

GroupNamesChecked example
Trig and inverse trigsin cos tan asin acos atanDEG: cos(60)+sin(30) = 1, asin(0.5) = 30
Hyperbolicsinh cosh tanhcosh(0) = 1, sinh(0) = 0
Powers and roots^ ** sqrt √ cbrt ∛9^(1/2) = 3, sqrt(144)+3^2 = 21
Logs and exponentialsln log lg log10 log2 explog(1000)+ln(e) = 4, log2(1024) = 10
Rounding and signabs round floor ceil signround(2.5)+floor(2.5)+ceil(2.5) = 8
Factorial and remainder! fact mod5!+3! = 126, 10 mod 3 = 1
Angle conversiondegrees radiansdegrees(pi/3) = 60, radians(180) = pi
Constantspi π e phi φ tauπ = 3.14159265359, e = 2.71828182846, φ = 1.61803398875, tau = 6.28318530718

Common questions

  • Why is -2^2 equal to -4?In mathematics minus x squared means the negative of x squared, so the power goes first. Use (-2)^2 for 4. The same rule makes 2^3^2 equal 512 rather than 64
  • Why does the result show 0.3 while the raw value is 0.30000000000000004?That is the inherent representation error of double-precision floating point. Automatic mode rounds to 12 significant figures to hide the noise; sqrt(2)*sqrt(8) shows 4 while the raw value is 4.000000000000001 for the same reason. Check the raw value row to see the real error
  • Degrees or radians?Degrees by default, so sin(30) is 0.5. In radians 30 means 30 radians and sin(30) is -0.988031624093. Inverse trig output follows the mode, so acos(0.5) is 60 in degrees. The degrees and radians functions ignore the switch and always convert by the radian definition
  • Why is sin(pi) not zero?The result is 1.224647e-16. Pi can only be stored approximately, and the rate of change of sine near pi is about -1, so input error becomes output error almost unchanged. Test against a tolerance instead of expecting an exact integer
  • How large a factorial can it handle?170! is 7.257416e+306, close to the double limit of about 1.8e308, and 171! reports overflow. Fractional and negative factorials are not supported because they need the Gamma function and complex numbers. Integer ratios such as 12!/(5!*7!) = 792 cancel safely before overflow
  • What does the percent sign mean?Divide by 100: 10% is 0.1 and 200*10% is 20. For a 10 percent increase write 200*(1+10%) = 220. A monthly 10 percent rise over a year totals (1+10%)^12-1 = 2.13842837672, or 213.84 percent
  • Does it execute the code I type?No. The input is tokenised, implicit multiplication is inserted, a shunting-yard pass produces postfix, and that is evaluated step by step. There is no eval and no dynamic function construction; letters are only accepted as registered function names and constants, and anything else is rejected with a position
  • What is not supported?Multi-argument functions (use log2(8) or log(8)/log(2)), variables and user-defined functions, complex numbers and infinity symbols, and summation or product notation. 1e3 is read as 1000, so write 1*e*3 for 1 times e times 3

Related tools: use the fraction calculator to turn a result back into an exact fraction, the percentage calculator for shares and changes, the compound interest calculator to expand a final value into a year-by-year table, and the unit converter for units. Expressions and results stay in the browser and are never uploaded.