2026-11-14 17:38 UTC
I think this, and the fact that NaN == NaN is false, make perfect sense.
NaN is the result of mathematically undefined behavior. You’re not going to get a NaN outside of a number context, so tying it together in the Number scope is fine.
Replies (4)
-
@threeonefour@piefed.ca 2026-11-14 17:45
The result of mathematically undefined behaviour should be an error, but sure, go ahead and return Keleven. 1/0 = keleven fuck it.
-
@asdfasdfasdf@lemmy.world 2026-11-14 18:57
Shouldn’t NaN be an error / exception then instead of a Number type?
-
@LillyPip@lemmy.ca 2026-11-14 20:16
Same reason NULL != NULL. It makes sense if you understand how these values work.
-
@VAK@lemmy.world 2026-11-15 03:46
It feels silly that a high level language has NaN at all