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