[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: NaN in Lua 5.3 Reference Manual
- From: "John Hind" <john.hind@...>
- Date: Sun, 25 Jun 2017 10:27:04 +0000
Enrique Garcia Cota said:
<<
Wouldn't this be enough?
function isNan(x)
return x ~= x
end
Or if you want something a bit more resistant against tables with
metatable magic:
function isNan(x)
return type(x) == 'number' and x ~= x
end
>>
Oh, that is so cleaver! I should know better than to suggest something
is impossible on this mailing list!
However depending on NaN being the *only* value that is not equal to
itself arguably fails my stipulation of robustness, and intuitive it
ain't! Is 'minus infinity' equal to itself? Is 'minus infinity' equal to
'plus infinity' even? (remembering we we not relying on IEEE
conformance). I think we enter deep philosophical waters!