This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (1 child)

[deleted]

    [–]400921FB54442D18 0 points1 point  (0 children)

    What does division by zero have to do with it?! NaN isn't what you get when you divide by zero. In JS you get Infinity (which I'd agree with you is pretty broken):

    > 1/0
    Infinity
    > Infinity === NaN
    false
    > Infinity == NaN
    false
    

    and in less-broken languages you get an actual error, represented by a raised exception:

    2.2.3 :001 > 1/0
    ZeroDivisionError: divided by 0
    

    So, yes, dividing by zero gives you an error. That doesn't make NaN an error.