Cool.

I wonder if there’s a difference between Flash and JS. The tests seem to 
indicate that isNaN() is very efficient in JS. It might be an interesting 
project to compare badly performing cases in Flash to their JS counterparts.

BTW, I just ran into a case where booleans behave differently in JS than AS 
where initialization would not help. I’ve started my document. I’ll add this 
case. Once the doc starts coming together I’ll share on the list. :-)

Harbs

> On Aug 3, 2017, at 3:59 PM, Josh Tynjala <joshtynj...@gmail.com> wrote:
> 
> Switching away from isNaN() in Feathers improved performance in a
> measurable way. It wasn't just a guess.
> 
> - Josh
> 
> On Aug 2, 2017 11:53 PM, "Harbs" <harbs.li...@gmail.com> wrote:
> 
> Ah. Thanks. (I haven’t had my coffee yet) ;-)
> 
> It would be interesting to know if that really is more efficient.
> 
>> On Aug 3, 2017, at 9:33 AM, Greg Dove <greg.d...@gmail.com> wrote:
>> 
>> I assume it is if (unknownNumOrNaN != unknownNumOrNaN )
>> 
>> I have used things like if (unknownNumOrNaN *0 !=0) in the past but the
>> above seems better
>> 
>> 
>> On Thu, Aug 3, 2017 at 6:20 PM, Harbs <harbs.li...@gmail.com> wrote:
>> 
>>> I’m curious. How does that work?
>>> unknownNumOrNaN != NaN will always be true
>>> 
>>>> On Aug 3, 2017, at 1:37 AM, Josh Tynjala <joshtynj...@gmail.com> wrote:
>>>> 
>>>> Good one! To avoid the overhead of the isNaN() function call, I
>>> frequently
>>>> rely on the fact that NaN != NaN.
>>>> 
>>>> - Josh
>>>> 
>>>> On Wed, Aug 2, 2017 at 3:32 PM, Harbs <harbs.li...@gmail.com> wrote:
>>>> 
>>>>> Thanks for the history lesson. :-)
>>>>> 
>>>>> This does bring up another difference between an initialized value of
>>> NaN
>>>>> and undefined:
>>>>> 
>>>>> NaN != NaN, while undefined == undefined
>>>>> 
>>>>>> On Aug 3, 2017, at 1:00 AM, Dave Fisher <dave2w...@comcast.net> wrote:
>>>>>> 
>>>>>> I hate this Macbook’s touch top bar which puts a send button directly
>>>>> above the delete key.
>>>>>> 
>>>>>>> On Aug 2, 2017, at 2:50 PM, Dave Fisher <dave2w...@comcast.net>
>>> wrote:
>>>>>>> 
>>>>>>> Hi Folks,
>>>>>>> 
>>>>>>> A peanut gallery look at NaN which is really a bit encoding for
>>> various
>>>>> kinds of floating point number errors like underflow, overflow, divided
>>> by
>>>>> 0, etc. In my Fortran past life we used XMISS as a special valu
>>>>>> 
>>>>>> Value. Essentially undefined.
>>>>>> 
>>>>>> IEEE had very particular definitions and Apple published a book about
>>>>> SANE.
>>>>>> 
>>>>>> At any rate what you guys are observing is by design: NaN always
>>> results
>>>>> in false in any comparison. And it is a number. But it is not a number
>>> in
>>>>> floating point so much as it is an error condition.
>>>>>> 
>>>>>> https://stackoverflow.com/questions/1565164/what-is-the-
>>>>> rationale-for-all-comparisons-returning-false-for-ieee754-nan-values
>>>>>> 
>>>>>> https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF
>>>>>> 
>>>>>> My father complained about when the IBM 360 came out in the early
>>> 1960’s
>>>>> he had to go to doubles because the IBM architecture went from 6 - 6
> bit
>>>>> words for a single to 4 - 8 bit words. The practical result was twice
> as
>>>>> much magnetic tape both length and number of reals.
>>>>>> 
>>>>>> Regards,
>>>>>> Dave
>>>>>> 
>>>>>>> 
>>>>>>>> On Aug 1, 2017, at 3:21 PM, Greg Dove <greg.d...@gmail.com> wrote:
>>>>>>>> 
>>>>>>>> Yes it does. NaN is an 'instance' of the Number type (even though it
>>> is
>>>>>>>> 'Not a Number' ;)  )
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Wed, Aug 2, 2017 at 10:18 AM, Harbs <harbs.li...@gmail.com>
>>> wrote:
>>>>>>>> 
>>>>>>>>> Interesting.
>>>>>>>>> 
>>>>>>>>> I’m not sure that I realized that NaN passes that test. Does it?
>>>>>>>>> 
>>>>>>>>>> On Aug 2, 2017, at 1:12 AM, Greg Dove <greg.d...@gmail.com> wrote:
>>>>>>>>>> 
>>>>>>>>>> I agree undefined works the same as NaN for many things for
>>> example,
>>>>> but
>>>>>>>>> it
>>>>>>>>>> fails on very basic things like if (x is Number)
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>> 
>>> 

Reply via email to