Youre expecting a string right? What happens if you do toString() on it first?
On 6/22/05, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> based off of that last test i do not believe it is an issue with "NaN" or
> "1" but rather the way the IS operator does its comparisons
>
>
>
> On 6/22/05, Bill Rawlinson <[EMAIL PROTECTED]> wrote:
> > I tested this on CFMX 6.1 and have the same behavior.
> >
> > I expanded your test some to do a getMetaData. Here is my test and I
> > put the result of each cfoutput block to the right in parentheses.
> >
> >
> > <cfset s = "NaN">
> >
> > <cfoutput>
> > #getMetaData(s)#<br> (class java.lang.String)
> > #getMetaData("1")#<br> (class java.lang.String)
> > </cfoutput>
> >
> > <cfset s = "one">
> > <cfset test = (s is "1")>
> > <cfoutput>#test# - #getMetaData(s)#</cfoutput><br> (NO
> class java.lang.String )
> >
> > <cfset s = "NaN">
> > <cfset test = (s is "one")>
> > <cfoutput>#test# - #getMetaData(s)#</cfoutput><br> (NO class
> java.lang.String)
> >
> > <cfset s = "NaN">
> > <cfset test = (s is "1")>
> > <cfoutput>#test#</cfoutput><br> ( The value "NaN" cannot
> be converted
> > to a number)
> >
> >
> > wierd stuff
> > Bill
> >
> >
> > On 6/22/05, Roland Collins < [EMAIL PROTECTED]> wrote:
> > > I'm seeing a very odd and very troubling behavior in CF, which I'm
> hoping
> > > someone can shed some light on or just confirm the oddity. It appears
> that
> > > "NaN" is a reserved word in CF, presumably because it is the "Not a
> Number"
> > > constant in Java", even though it shouldn't be. Dump this code in a
> page
> > > and try it in CF (I'm using 7):
> > >
> > > <cfset s = "one">
> > > <cfset test = (s is "1")>
> > > <cfoutput>#test#</cfoutput>
> > >
> > > <cfset s = "NaN">
> > > <cfset test = (s is "one")>
> > > <cfoutput>#test#</cfoutput>
> > >
> > > <cfset s = "NaN">
> > > <cfset test = (s is "1")>
> > > <cfoutput>#test#</cfoutput>
> > >
> > > Now, I would _expect_ the code to generate "No No No". But guess what
> > > happens . . . The first two statements work fine, but the third one
> throws a
> > > *type conversion* error. More specifically, it throws "The value "NaN"
> > > cannot be converted to a number".
> > >
> > > Type-less language, my backside! Why is it trying to do a number
> conversion
> > > here? I even have the "1" in quotes, for Pete's sake. It doesn't even
> work
> > > if I add spaces around it, as in " NaN " or " 1 ". And it gets even
> > > _sloppier_ . . . this only occurs if you use the capitalization "NaN".
> > > "NAN", "Nan", "nan", etc. work just fine. Since when is CF
> > > case-sensitive??!?!?!
> > >
> > > Now here's why it's a problem - "NAN" is a perfectly valid user-input
> > > statement in our system (think stock symbols). So now whenever we
> perform
> > > user-validation, we have to have a special filter for "NaN" and make
> sure it
> > > is converted to either all upper or all lower case!
> > >
> > > Does anyone else find this frightening?
> > >
> > > Does anyone know where the link to report CF bugs went?
> > >
> > > Roland
> > >
> > >
> > >
> > >
> > >
> > >
> ----------------------------------------------------------
> > > You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the
> email.
> > >
> > > CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (
> www.cfxhosting.com).
> > >
> > > CFCDev is supported by New Atlanta, makers of BlueDragon
> > > http://www.newatlanta.com/products/bluedragon/index.cfm
> > >
> > > An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
> > >
> > >
> > >
> >
> >
> > --
> > [EMAIL PROTECTED]
> > http://blog.rawlinson.us
> >
> > If you want Gmail - just ask.
> >
> >
> >
> ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the
> email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (
> www.cfxhosting.com).
> >
> > CFCDev is supported by New Atlanta, makers of BlueDragon
> > http://www.newatlanta.com/products/bluedragon/index.cfm
> >
> > An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
> >
> >
> >
>
> ----------------------------------------------------------
>
> You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the
> email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> (www.cfxhosting.com).
>
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
--
Ryan Guill
BlueEyesDevelopment
[EMAIL PROTECTED]
www.ryanguill.com
(270) 217.2399
Want gmail? Get it here while its hot.
www.ryanguill.com/blog/
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]