Just an update... the new code below does the same thing. <cfset a = 0> <cfset b = 0> <cfset c = 0> <cfloop from="1" to="1000" index="i"> <cfset a = RandRange(100,10000)> <cfset b = a*2> <cfset c = val("#ListFirst(Trim(a),".")#.00")> <cfset c = c + 0.1> <cfset d = a - b + c> <cfoutput>#a#-#b#+#c# = #d#<br /></cfoutput> </cfloop> Barry Beattie wrote: not having a working CF server handy at the moment to test, I'm just curiousyou're not getting grief with treating strings as numbers, are you? perhaps a val( "#ListFirst(Trim(a),".")#.00" ) is needed? just a quick thought b On 2/20/07, Gareth Edwards <[EMAIL PROTECTED]> wrote: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 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