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

From: David Herman (dherman at ccs.neu.edu)
Date: Wed Oct 27 18:15:44 EDT 2010

Does (not (= x x)) work? That's the way people sometimes do it JavaScript, so it can't be wrong.

Dave

On Oct 27, 2010, at 1:20 PM, 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?
> 
> Doug
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev



Posted on the dev mailing list.