4 ms·
The following is my take: It seems like the desired result is to make it determinable when a NaN value is produced in a language that doesn't have an is_nan fu
by zenogais 12y ago
The following is my take:
It seems like the desired result is to make it determinable when a NaN value is produced in a language that doesn't have an is_nan function (such as an assembly language lacking such a predicate) so that a simple boolean statement does the trick, for example:
def is_nan(val):
return not (val == val)
This absolutely bizarre statement of non-identity gives us a surefire test. It is from the perspective of higher level languages that the non-identity of NaN with itself seems bizarre.
- dllthomas 12y agoIf NaN == NaN, we'd still have that test, it would just read def is_nan(val): return (val == NaN) It's true that it can't just give NaN or you'd be stuck.