I think this has something to do with the IEEE 754 standard, Excel (and a few other programs) have the same problem.

I got around this by comparing them as strings instead of numbers (hey I was in a bind, but it works...)

<cfset intOne = 12345678901234567890>
<cfset intTwo = 12345678901234567891>

<cfif "x#intOne#" eq "x#intTwo#">
    match
<cfelse>
    no match
</cfif>

Returns "no match".  Note, just putting numbers inside double quotes will not trigger string comparisons, it needs a letter or something.


Hope this helps!
-James

Mark Davis wrote:

I am posting this for a co-worker…

 

He is trying to see if two 18 character number strings are equal and finding that anything over 16 digits always comes back as a match

 

This one returns: NO MATCH (16 digits)

<cfif 1234567890123456 EQ 1234567890123457>

            match

<cfelse>

            no match

</cfif>

 

 

This one returns: MATCH (17 digits)

<cfif 12345678901234567 EQ 12345678901234568>

            match

<cfelse>

            no match

</cfif>

 

Anyone have a clue as to why this is?

 

Mark Davis
Cricket Communications
Software Engineer III

303-734-7694 (w)

 




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to