emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q on NaN


From: Luc Teirlinck
Subject: Re: Q on NaN
Date: Fri, 24 Jun 2005 17:31:23 -0500 (CDT)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]