Evaluates one or more string expressions using BigDecimal precision arithmetic. If the results ends in a infinitely repeating decimal value only the first 20 digits of the decimal portion will be used. BigDecimal precision results only work with addition, subtraction, multiplication and division. The use of ^, MOD, % or \ arithmetic operators will result in normal integer precision.

precisionEvaluate(expressions) → returns numeric

precisionEvaluate Argument Reference

expressions string

Expressions to evaluate

Examples sample code invoking the precisionEvaluate function

1/3 is calculated then 5 is added to the total. Display is limited to 20 threes.

precisionEvaluate( 1/3 + 5 )

Expected Result: 5.333333333333

Calculate 1 divided by the product of 7 x 12

precisionEvaluate( 1/(7*12) )

Expected Result: 0.011904761905

Fork me on GitHub