Re: Q on NaN

2005-06-25 Thread Richard M. Stallman
BTW, here is something I didn't expect: `M-: 0.0e+NaN' returns -0.0e+NaN `M-: -0.0e+NaN' returns 0.0e+NaN The reader seems to flip the (irrelevant) sign. I fixed that. Thanks. ___ Emacs-devel mailing list Emacs-devel@gnu.org http

Re: Q on NaN

2005-06-24 Thread Luc Teirlinck
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;

RE: Q on NaN

2005-06-24 Thread Drew Adams
(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 no

RE: Q on NaN

2005-06-24 Thread Drew Adams
> I didn't say above that (/0.0 0.0) should give `arith-error'. Well, you seemed to: you complained that it did so in previous versions. No, I said "fair enough" to that change in behavior. I did not suggest it was a bug. My question was about numberp's behavior: > I suggested th

Re: Q on NaN

2005-06-24 Thread Eli Zaretskii
> From: "Drew Adams" <[EMAIL PROTECTED]> > Date: Fri, 24 Jun 2005 13:26:23 -0700 > > I didn't say above that (/0.0 0.0) should give `arith-error'. Well, you seemed to: you complained that it did so in previous versions. > I suggested > that perhaps `numberp' should return nil for a NaN argument,

Re: Q on NaN

2005-06-24 Thread Luc Teirlinck
Drew Adams wrote: That doesn't tell me how to test if `foobar' is a NaN. See my previous email: I knew I could test `(equal foo 0.0e+Nan)', but I thought I would need to test against all of the possible NaN values. The GNU C library has an isnan macro. From Lisp you could do: (defun

Re: Q on NaN

2005-06-24 Thread Gaƫtan LEURENT
Drew Adams wrote on 24 Jun 2005 22:26:23 +0200: > That doesn't tell me how to test if `foobar' is a NaN. See my previous > email: I knew I could test `(equal foo 0.0e+Nan)', but I thought I would > need to test against all of the possible NaN values. You just need to test (= foobar foobar) --

RE: Q on NaN

2005-06-24 Thread Drew Adams
> (numberp (/0.0 0.0)) returns t. That seems like a bug to me. Maybe it is, maybe it isn't. (elisp)Arithmetic Operations says: If you divide an integer by 0, an `arith-error' error is signaled. (*Note Errors::.) Floating point division by zero returns either i

RE: Q on NaN

2005-06-24 Thread Drew Adams
Still following up on my own post: (condition-case nil (setq foo (/ 0.0 0.0)) (arith-error nil)) In older versions of Emacs (at least prior to April 2005 CVS), this would evaluate to nil. Now, it evaluates to -0.0NaN. I can modify the code like so: (and (condition-case nil (setq foo (/ 0

Re: Q on NaN

2005-06-24 Thread Eli Zaretskii
> From: "Drew Adams" <[EMAIL PROTECTED]> > Date: Fri, 24 Jun 2005 12:33:53 -0700 > > (condition-case nil (setq foo (/ 0.0 0.0)) (arith-error nil)) > In older versions of Emacs (at least prior to April 2005 CVS), > this would evaluate to nil. Now, it evaluates to -0.0NaN. > I can m

Q on NaN

2005-06-24 Thread Drew Adams
Consider this: (condition-case nil (setq foo (/ 0.0 0.0)) (arith-error nil)) In older versions of Emacs (at least prior to April 2005 CVS), this would evaluate to nil. Now, it evaluates to -0.0NaN (on Windows, at least), which breaks the encompassing code (which tests the above expression for non

RE: Q on NaN

2005-06-24 Thread Drew Adams
I said this: (condition-case nil (setq foo (/ 0.0 0.0)) (arith-error nil)) In older versions of Emacs (at least prior to April 2005 CVS), this would evaluate to nil. Now, it evaluates to -0.0NaN. I can modify the code like so: (and (condition-case nil (setq foo (/ 0.0 0.0)) (a