Math evaluator
What is a Math Evaluator?
A math evaluator calculates the result of a whole expression typed as text, instead of pressing calculator buttons one step at a time. You can write (3 + 4) * 2 ^ 3 / sqrt(16) exactly as you would on paper and get the answer instantly. It is handy for quick engineering checks, unit conversions, spreadsheet-style formulas and verifying results from code.
How to use it
- Type or paste an expression.
- Read the result, which updates as you type.
- Fix any syntax error shown, such as a missing parenthesis.
Supported syntax
- Operators:
+,-,*,/,^(power) and%(modulo). - Functions:
sqrt,abs,round,floor,ceil,log,exp,sin,cos,tanand more. - Constants:
piande.
Worked examples
2 + 3 * 4= 14, because multiplication is done before addition.(2 + 3) * 4= 20.sqrt(3^2 + 4^2)= 5, the Pythagorean hypotenuse.1000 * (1 + 0.05)^10= 1628.89, ten years of 5% compound growth.
Common pitfalls
- Angles are in radians.
sin(90)is not 1; usesin(pi / 2)or convert degrees with* pi / 180. - Power associativity:
2 ^ 3 ^ 2is evaluated as2 ^ 9= 512, not 64. - log base: in many math libraries
logis the natural logarithm. Uselog10orlog(x, 10)for base 10 if supported. - Floating point:
0.1 + 0.2may show 0.30000000000000004, a normal effect of binary floating-point numbers.
Expressions are evaluated locally in your browser.
Frequently Asked Questions
What order are operations evaluated in?
Standard precedence: parentheses first, then powers, then multiplication and division, then addition and subtraction.
Are trigonometric functions in degrees or radians?
Radians. Multiply degrees by pi and divide by 180 to convert, for example sin(30 * pi / 180).
Why does 0.1 + 0.2 not give exactly 0.3?
Computers store decimals in binary floating point, which cannot represent 0.1 exactly. The tiny error is normal.
Can I use constants like pi?
Yes. pi and e are available as built-in constants.