Hacker News new | ask | show | jobs
by fpaboim 4359 days ago
This discussion is ridiculous. NaN should obviously return true of isNumber, and probably just indicates you did something funky with your numbers and they exploded. They're still numbers, you're the one who's at fault (I never really saw NaN come by on purpose...). It's just that computers can't really represent some numbers and when that happens you get NaN and as much as you want languages to read as english or be perfect abstractions sometimes practical implementations details end up surfacing and theres nothing you can do.
3 comments

But there is something we can do. We can make the context clear and resolve this.
> I never really saw NaN come by on purpose

We use NaN for masking in image processing, for instance for filtering out defective pixels. If a pixel has value NaN, it is ignored across the board.

1%0 is not found on the number line. It's not a number.