(equal 0.0e+NaN) <=?=> (and (numberp x) (/= x x))
        That is, are there any objects equal to 0.0e+NaN that are not NaN?

    They are equivalent. internal_equal contains:
       ...
          /* If d is a NaN, then d != d. Two NaNs should be `equal' even
             though they are not =. */

Thanks for confirming. I guess I could have searched the code myself - mea
culpa.

Given the equivalence, I suggest that the clearest idiom is (equal foo
0.0e+NaN).

We should mention this use of `equal' with NaN in the doc: anything `equal'
to a NaN is NaN (all NaN are `equal').

We should also mention the trick (and (numberp foo) (/= foo foo)) ==> foo is
NaN.

We might still want to add a standard predicate for testing NaN-ness:
`nanp'. (`not-a-number-p' would be confusing.)



_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to