Evaluates a mathematical expression given as a string.
Supports the use of parameter placeholders (prefixed with $), which are replaced with values from the parameters object before evaluation.
You can use numbers, placeholders, and the following functions within the expression:
avg(p1, p2, ...): Returns the average of the given numbers.
pow(p1, p2): Returns the result of raising p1 to the power of p2.
pi(): Returns the value of PI.
e(): Returns the value of Euler's number (e).
Parameters
toEval: string
The formula string to evaluate. Placeholders must be in the form of $paramName.
Evaluates a mathematical expression given as a string. Supports the use of parameter placeholders (prefixed with
$
), which are replaced with values from theparameters
object before evaluation.You can use numbers, placeholders, and the following functions within the expression:
avg(p1, p2, ...)
: Returns the average of the given numbers.pow(p1, p2)
: Returns the result of raisingp1
to the power ofp2
.pi()
: Returns the value of PI.e()
: Returns the value of Euler's number (e).