cf_doggie
asked on
ColdFusion Can't Subtract Decimals
OK, This is a nutty one.
Run this code and tell me what result you get.
<cfset number_one = 179.03>
<cfset number_two = 179.02>
<cfset the_difference = number_one - number_two>
<cfoutput>
#the_difference#
</cfoutput>
I should mention I am running CFMX 7.01 on Win2K3
The result I get is 0.00999999999999 and I have checked it repeatedly and run JUST that function on the page with no other code at all... same result.
Now I know I can round but the mere fact that ColdFusion can't subtract decimal figures is particularly frightening. Its is simply not feasible to place the round() function on every use of a fraction in an application.
Anyone have any ideas what is causing this?
** More info - only seems to happen when result is the result is (should be) 0.01 as I tested lots of other options which worked fine. This is more bizarre by the minute.
Run this code and tell me what result you get.
<cfset number_one = 179.03>
<cfset number_two = 179.02>
<cfset the_difference = number_one - number_two>
<cfoutput>
#the_difference#
</cfoutput>
I should mention I am running CFMX 7.01 on Win2K3
The result I get is 0.00999999999999 and I have checked it repeatedly and run JUST that function on the page with no other code at all... same result.
Now I know I can round but the mere fact that ColdFusion can't subtract decimal figures is particularly frightening. Its is simply not feasible to place the round() function on every use of a fraction in an application.
Anyone have any ideas what is causing this?
** More info - only seems to happen when result is the result is (should be) 0.01 as I tested lots of other options which worked fine. This is more bizarre by the minute.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.