Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What about NaN? Does Erlang have NaN? How does Erlang compare two variables containing a NaN (or expressions evaluating to a NaN)? There are (2^24)-2 different NaNs in a 32bit IEEE 754 float, and there are (2^53)-2 different NaNs in a 64bit IEEE 754 double. The IEEE 754 standard says, that a NaN value should compare to any other number (including any other NaN) as not equal. Yes, the expression `x == x` could return `false`.


Erlang has =:= and ==. Kind of like how Python has is and ==, JavaScript has == and ===, and Lisp has eq, eql, and equal.

The change in the article is about =:=, so NaN =:= NaN does not have to give the same answer as NaN == NaN.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: