In XPath 3, the following expression :
 
(1, "NaN", xs:double("NaN")) ! (. instance of xs:numeric and string() eq "NaN")
 
will return:
 
false false true
 
--Alain