Not sure why it would do that, but it does it in CF4.1 as well. Try
this:
#Evaluate(Round(calc*100)/100)#
try this: <cfoutput> <cfset calc=652.06 - 652> #calc# </cfoutput> The result should be 0.06, but CF returns 0.0599999999999 ! Does anybody know a workaround?...
try this:
<cfoutput>
<cfset calc=652.06 - 652>
#calc#
</cfoutput>
The result should be 0.06, but CF returns 0.0599999999999 !
Does anybody know a workaround?
Not sure why it would do that, but it does it in CF4.1 as well. Try
this:
#Evaluate(Round(calc*100)/100)#
<cfset calc=DecimalFormat(652.06 - 652)>
I'm guessing that since CF is Java-based, a decimal value is stored as a float
value, which has so many bytes. Additionally, essentially, 0.0599999999999 =
0.06...that's pure Math, and I don't remember any of that, but take my
word...it is. :-)
Hope that this helps. Thanks.
Chris
<cfset calc = (((652.06*100) - (652*100))/100)>
Bookmarks