Evaluates one or more string expressions using BigDecimal precision arithmetic. If the results ends in an 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

Argument Reference

expressions string

Expressions to evaluate

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

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub