Here's an article about isNaN is JS. http://adripofjavascript.com/blog/drips/the-problem-with-testing-for-nan-in -javascript.html
Maybe the transpiler should not output isNaN and instead "someNumber !== someNumber" -Alex On 8/3/17, 6:30 AM, "Harbs" <harbs.li...@gmail.com> wrote: >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://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsta >>>>>>>ckoverflow.com%2Fquestions%2F1565164%2Fwhat-is-the-&data=02%7C01%7C% >>>>>>>7Cf21eaebf1ebe4106701408d4da73e58d%7Cfa7b1b5a7b34438794aed2c178decee >>>>>>>1%7C0%7C0%7C636373638698893388&sdata=y0%2BkjVQhq9ALdDR5QSKUVtzmggB66 >>>>>>>8usWbRnc9fZFC8%3D&reserved=0 >>>>>> rationale-for-all-comparisons-returning-false-for-ieee754-nan-values >>>>>>> >>>>>>> >>>>>>>https://na01.safelinks.protection.outlook.com/?url=https:%2F%2Fpeopl >>>>>>>e.eecs.berkeley.edu%2F~wkahan%2Fieee754status%2FIEEE754.PDF&data=02% >>>>>>>7C01%7C%7Cf21eaebf1ebe4106701408d4da73e58d%7Cfa7b1b5a7b34438794aed2c >>>>>>>178decee1%7C0%7C1%7C636373638698893388&sdata=ZNxIS0ccBrtUNO%2B4hto7a >>>>>>>e425rLH2x1H0MDK7uA5pio%3D&reserved=0 >>>>>>> >>>>>>> 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) >>>>>>>>>> >>>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>>> >>>> >>>> >