Interesting Findings.
* First off I noticed that we set as variables then compared the same issue exists. * I also noticed that 107407.40+12345.68+3703.70 evaluates to be LESS THAN 123456.78 * I then tried numeric variations to replicate this problem with other numbers and saw that the problem disappeared with a result and comparison total ending in .76 and .79 but remained for .77 * Finally I discovered adding 0.00000000001 made the numbers equal again ie (107407.40+12345.68+3703.70+0.00000000001) I'm baffled. I have other things I want to try though Kier Simmons Analyst/Programmer [cid:[email protected]]<http://www.giveblood.org/> Phone: 713-791-6619 Toll Free: 1-888-482-5663 Fax: 713-791-6681 www.giveblood.org<http://www.giveblood.org> P Please consider the environment before printing this e-mail. ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Brett Roderick Sent: Friday, May 29, 2009 10:38 AM To: [email protected] Subject: [houcfug] decimal math issues I seem to run into ColdFusion math problems with decimal numbers from time to time. For example, I would expect the following to return EQUAL but instead it returns NOT EQUAL (on CF 8.0.1): <cfif 107407.40+12345.68+3703.70 IS 123456.78>EQUAL<cfelse>NOT EQUAL</cfif> I've fixed problems like this in the past with this: round(x*100)/100 I don't have confidence that will always work. Is there a better way to deal with this? I'm not looking forward to putting something like that in everywhere we do any computations with decimal numbers. Thanks, Brett The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed, and may contain information that is PRIVILEGED, CONFIDENTIAL, and exempt from disclosure under applicable law. If you are not the intended recipient, you are prohibited from copying, distributing, or using the information. Please contact the sender immediately by return e-mail and delete the original message from your system. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Houston ColdFusion Users' Group" discussion list. To unsubscribe, send email to [email protected] For more options, visit http://groups.google.com/group/houcfug?hl=en -~----------~----~----~----~------~----~------~--~---
<<inline: image001.gif>>
