unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Q on NaN
@ 2005-06-24 19:06 Drew Adams
  2005-06-24 19:33 ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2005-06-24 19:06 UTC (permalink / raw)


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-nil).

Fair enough. I can modify the code like so:

(and (condition-case nil (setq foo (/ 0.0 0.0)) (arith-error nil))
     (bar foo)) ; foo must be a number, not a NaN

What function do I use for bar?

`numberp' doesn't work, since (numberp -0.0NaN) is non-nil. That seems odd
to me, since NaN means "not a number" and numberp means "a number", but I
guess I can live with a little oddness.

In the Elisp manual, I didn't find a predicate to test for NaN.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-06-25 13:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-24 19:06 Q on NaN Drew Adams
2005-06-24 19:33 ` Drew Adams
2005-06-24 19:46   ` Drew Adams
2005-06-24 21:01   ` Eli Zaretskii
2005-06-24 20:26     ` Drew Adams
2005-06-24 20:56       ` Gaëtan LEURENT
2005-06-24 20:59       ` Luc Teirlinck
2005-06-24 22:03       ` Eli Zaretskii
2005-06-24 21:49         ` Drew Adams
2005-06-24 22:31           ` Luc Teirlinck
2005-06-24 22:54             ` Drew Adams
2005-06-25 13:35       ` Richard M. Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).