Andy, there were some nasty number comparison bugs in CF8 at one point, do you have the latest updaters installed?
Adma On Mon, Jul 13, 2009 at 9:13 AM, Andy Wu <[email protected]> wrote: > > Hi Peter, > > Thanks for the thorough explanation. You're absolutely correct in > concluding the issue is down to the underlying type differences. > > I can update OpenBD so that it will identify 1 and "1" as equal though > admittedly I'm unsure as to whether I should replicate CF's behaviour > entirely. If the numbers involved are negative, CF8 will output false: > > <cfset a = -1> > <cfset b = "-1"> > > <cfoutput> > #a.equals(b)#<br> > </cfoutput> > > I'd rather be consistent and output true in both cases. > > Andy > > Peter J. Farrell wrote: > > I think I've narrowed down the issue. If I change ComparisonA to this > > (notice the quotes around the values): > > > > <cfset comparisonA[1] = "1" /> > > <cfset comparisonA[2] = "2" /> > > > > The results change to this: > > A to B: false > > A to C: true > > > > Clearly this has to do with "1" being like a "string" and when it's just > > 1 then it's just a "numeric". Essentially they should be the both > > return true when a comparison is being done? > > > > Best, > > .Peter > > > > P.s. I've also tried this with structs (which is Issue 43) using the > > same function (which I won't paste in again) and the same equals stuff > > does not work: > > > > <cfset variables.parsedXml = XmlParse('<root><struct name="test"><key > > name="a" value="1"/><key > > name="b"><value>2</value></key></struct></root>') /> > > > > <cfset comparisonA = StructNew() /> > > <cfset comparisonB = StructNew(1) /> > > <cfset comparisonC = recurseComplexValues(variables.parsedXml.root) /> > > > > <cfset comparisonA.a = "1" /> > > <cfset comparisonA.b = "2" /> > > > > <cfset comparisonB.a = 1 /> > > <cfset comparisonB.b = 2 /> > > > > A to B:<cfdump var="#comparisonA.equals(comparisonB)#"><br/> > > A to C:<cfdump var="#comparisonA.equals(comparisonC)#"> > > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ Open BlueDragon Public Mailing List http://groups.google.com/group/openbd?hl=en official site @ http://www.openbluedragon.org/ !! save a network - trim replies before posting !! -~----------~----~----~----~------~----~------~--~---
