This is not a new issue.  It happens in javascript, too, as I found out 
about 6 months ago.  Jim was nice enough to point out the problem to me.

Google "floating point arithmetic" to read up on it.  It's complicated, 
but makes sense once you get your head 'round it.

[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
>>The reason is that floating point arithmetic is not exact.  You end up
>>with a very small error (1.42108547152E-014) that CF expresses as
>>scientific notation.  When you run val() on it, it strips the
>>exponent, so you're left with something that's 14 orders of magnitude
>>off of what the real result is.
> 
> 
> That is harsh. I have never ever run into this before and I am very afraid 
> that I could have a lot of code effected by this problem. What is it that I 
> am doing "incorrectly", using val()? It seems to me that either the floating 
> point calculation should be more accurate, or val() should correctly 
> interpret the scientific notation CF uses. I mean, if I do 
> dollarformat(val(shiptotal+subtotal+discount)) where shiptotal = 15.12 and 
> subtotal = 59.70 and the discount = -74.82 it seems logical to me to expect 
> the result to be $0.00, not $1.42.
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226265
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to