@b0rk
very good.
minor addendum: most programming languages have a specific function like isnan() which returns true if a floating point value is NaN, and related functions like isinf(), isnormal() and so forth.
Have you ever wondered how dynamic typing, like in JS, works under the hood? There are some obvious solutions in this matter, however, there is also one which is more than brilliant.
@b0rk things get _really_ interesting when you try to use floating point numbers as hashmap keys:
* NaN is unequal to itself, so a hashmap should allow putting many NaNs in a hashmap.
* Retrieving a value by NaN key should never return anything (because NaN != NaN).
* +0 and -0 have a different bit pattern, but are still equal so only one should be allowed (important for hashing).
Not all languages are so strict with float semantics in hashmaps, though.
https://research.swtch.com/randhash
@b0rk Nice. Might be worth specifying this applies to IEEE 754. Some computers (VAX, IBM) have different FP formats.
Maybe also mention all comparisons with NaN are always false.
5.0 < NaN: false
5.0 > NaN: false
5.0 == NaN: false
Many people find it surprising that trichotomy doesnโt hold for NaN.