Drew Adams wrote:

   Does anyone know that these are not equivalent:

    (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:

    case Lisp_Float:
      {
      double d1, d2;

      d1 = extract_float (o1);
      d2 = extract_float (o2);
      /* If d is a NaN, then d != d. Two NaNs should be `equal' even
         though they are not =. */
         return d1 == d2 || (d1 != d1 && d2 != d2);
      }



   Yes, for testing a numberp to see if it is not NaN. However, I am
   testing an arbitrary object. For that, (and (numberp x) (/= x x))
   works and (equal x 0.0e+Nan) works.

Yes.

Sincerely,

Luc.


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
  • Re: Q on NaN Luc Teirlinck

Reply via email to