The Wikipedia article on NaN states:
A NaN does not compare equal to any floating-point number or NaN, even if the latter has an identical representation. One can therefore test whether a variable has a NaN value by comparing it to itself (i.e. if x != x then x is NaN).
n# = Sqr(-1) Print n If n = 0 Then Print "oops" If Not(n <> n) Then Print "oops"