[–] skerit 1y ago ↗ What? `NaN` isn't some primitive constant like `true`, `false`, `null` or `undefined`? It _actually_ is a number? [–] dgroshev 1y ago ↗ Yes! Since any function returning a float might need to return NaN, NaNs are represented as a special kind of float, with most bits unused. [–] skerit 1y ago ↗ Cool. Is that why NaN isn't equal to anything? Not even when comparing a NaN variable to itself? (I assume it's because you can't have some NaN values be equal, and others not)
[–] dgroshev 1y ago ↗ Yes! Since any function returning a float might need to return NaN, NaNs are represented as a special kind of float, with most bits unused. [–] skerit 1y ago ↗ Cool. Is that why NaN isn't equal to anything? Not even when comparing a NaN variable to itself? (I assume it's because you can't have some NaN values be equal, and others not)
[–] skerit 1y ago ↗ Cool. Is that why NaN isn't equal to anything? Not even when comparing a NaN variable to itself? (I assume it's because you can't have some NaN values be equal, and others not)
3 comments
[ 3.3 ms ] story [ 27.9 ms ] thread