[racket-dev] Equality test for Not-A-Number

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Oct 27 18:18:51 EDT 2010

At Wed, 27 Oct 2010 14:20:37 -0600, Doug Williams wrote:
> What is the correct way to test for +nan.0 in Racket? For example, (= +nan.0
> +nan.0) = #f. This seems to be the behavior specified in R6RS. In the
> science collection I implemented nan? using eqv?, which seems to work in
> Racket; but the result is explicitly unspecified in R6RS, which I assume
> means that it's up to the implementation. Which pretty much leaves eq? as
> the proper test. R6RS includes primitives like nan? and infinite?, which I
> included a long time ago in the science collection. Obviously one can use
> them from the r6rs libraries, but should they be moved into the racket
> language?

`eq?' will not work, while Racket (unlike R6RS) promises that `eqv?'
will work.

At Wed, 27 Oct 2010 15:15:44 -0700, David Herman wrote:
> Does (not (= x x)) work?

Yes, that would work too.

Posted on the dev mailing list.