>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. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226262 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

