-
Notifications
You must be signed in to change notification settings - Fork 0
Home
AndyNoob edited this page Jan 22, 2024
·
5 revisions
Welcome to the math-expressions wiki! This page will be a quick guide on the syntax required by the parser.
MathExpression.parse("1 + 1 - 3 + x").setVariable("x", 9).evaluate(); // output: 8
While floating-point notation is not supported, any real number is supported:
-
1
,10
,-1024
-
0.2454
,-3.04593
,9.3333
Please do note that numbers are still subject to floating-point inaccuracy.
Currently, these operators are supported (and executed in order of):
- Power (
^
) - Multiply, divide (
*
&/
) - Add, subtract (
+
&-
)
Opening parentheses are paired with the closest closing parentheses.