It hasn't been a problem previously, why would it be a problem now?
CFML is not a strong typed language and there for should evaluate
situations like this correctly. Cheers Gareth. Ryan Sabir wrote: They looks like pretty standard floating point rounding errors. You get them in any programming language where you deal with fractions.The trick is to expect that this will happen and plan your application around it.-----Original Message----- From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Gareth Edwards Sent: Tuesday, 20 February 2007 12:05 PM To: CFAussie Mailing List Subject: [cfaussie] Strange calculation behavior on CF 7.02 If you are running coldfusion 7.02, or maybe 7.01 or 7.0? (don't know) Run this script below, and tell me if you get the same results for each line. The way I see it, d should equal 0.1 on every row. But this isn't the case. Is this a bug introduced by Coldfusion 7.02? <cfset a = 0> <cfset b = 0> <cfset c = 0> <cfloop from="1" to="1000" index="i"> <cfset a = RandRange(10000,20000)> <cfset b = a*2> <cfset c = "#ListFirst(Trim(a),".")#.00"> <cfset c = c + 0.1> <cfset d = a - val(b) + val(c)> <cfoutput>#d#<br /></cfoutput> </cfloop> Cheers Gareth. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~--- |
- [cfaussie] Re: Strange calculation behavior on CF 7.02 Gareth Edwards
- [cfaussie] Re: Strange calculation behavior on CF ... Ryan Sabir
- [cfaussie] Re: Strange calculation behavior on... Gareth Edwards
- [cfaussie] Re: Strange calculation behavio... Brett Payne-Rhodes
- [cfaussie] Re: Strange calculation behavior on CF ... Ryan Sabir
- [cfaussie] Re: Strange calculation behavior on... Gareth Edwards
- [cfaussie] Re: Strange calculation behavior on CF ... Ryan Sabir
- [cfaussie] Re: Strange calculation behavior on... Gareth Edwards
- [cfaussie] Re: Strange calculation behavio... Andrew Scott
- [cfaussie] Re: Strange calculation beh... Gareth Edwards
- [cfaussie] Re: Strange calculation behavior on CF ... Ryan Sabir