Question
5.52 + 13.49 - 19.01 - 0 = -3.5527136788 ??? why not 0??
I have a little problem with my cf application.
I have code like this : <cfset holidayclaim = val(holidayclaim) + val(leave) - val(leavetaken) - val(truncday)>
when I output value for each variable, here is what I got :
Before calculation :
holidayclaim = 5.52
leave = 13.49
leavetaken = 19.01
truncday = 0
after calculation
holidayclaim = -3.5527136788
This is WRONG, after calculation holidayclaim result should be 0.
Then I run another test using <cfset test = 5.52 + 13.49 - 19.01 - 0>
When I output "test" value I got -3.5527136788E-015
How come this happen? This is just a simple math operation involve add and subtract only. Anyone know what function should I use to make the calculation result correct? I'm using CF 8,0,1,195765 on windows 2003 server.
Thanks
I have code like this : <cfset holidayclaim = val(holidayclaim) + val(leave) - val(leavetaken) - val(truncday)>
when I output value for each variable, here is what I got :
Before calculation :
holidayclaim = 5.52
leave = 13.49
leavetaken = 19.01
truncday = 0
after calculation
holidayclaim = -3.5527136788
This is WRONG, after calculation holidayclaim result should be 0.
Then I run another test using <cfset test = 5.52 + 13.49 - 19.01 - 0>
When I output "test" value I got -3.5527136788E-015
How come this happen? This is just a simple math operation involve add and subtract only. Anyone know what function should I use to make the calculation result correct? I'm using CF 8,0,1,195765 on windows 2003 server.
Thanks
