Why does coldfusion 8 evaluate 47.0000 * 15.40 eq 723.8 as false?
<cfset test = false />
<cfset a = 47.0000 />
<cfset b = 15.40 />
<cfset c = 723.8 />
<cfif (a * b) eq c>
<cfset test = true />
</cfif>
<cfdump "#test#">
Test is output as false.
You can use PrecisionEvaluate() to have CF use BigDecimals to do the math.
<cfset test = false />
<cfset a = 47.0000 />
<cfset b = 15.40 />
<cfset c = 723.8 />
<cfif PrecisionEvaluate(a * b) eq c>
<cfset test = true />
</cfif>
<cfdump var="#test#" abort="true">
This results in the expected answer of true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With