News for hackers. Stuff that matters.
Re:NaN does not mean "I am not a number” by personjerry on Thursday July 10, 2014 @08:54PM (#8018332)
tl;dr: Guy suggests isNumber(NaN) should be false. But it's true because NaN is part of floating points as defined by IEEE.

My own interpretation? While programmers shouldn't care so much about this particular kind of semantics (instead they should understand the theory behind floats and never have to run into this issue) it might be better just to call NaNs something else, like "undefined number" or something.

Re:NaN does not mean "I am not a number” by dragonwriter on Thursday July 10, 2014 @09:07PM (#8018369)
> My own interpretation? While programmers shouldn't care so much about this particular kind of semantics (instead they should understand the theory behind floats and never have to run into this issue) it might be better just to call NaNs something else, like "undefined number" or something.

Or, better, call the JavaScript type that represents IEEE-754 Binary64 format -- which includes the union of three sets (finite numbers in a given range, two infinite numbers, and two kinds of Not-a-Number values) something other than "Number".

Re:NaN does not mean "I am not a number” by wlievens on Friday July 11, 2014 @03:40AM (#8019200)
As dragonwriter has remarked above, the type "Number" includes stuff that isn't a number. That's a bit absurd, it's like having a value "Red" for a "Color" type.

The type should obviously have been called Float or some variant of that, and the type identification function isFloat.