[r6rs-discuss] Re: [Formal] eq?/eqv? misbehave around NaNs

From: John Cowan <cowan>
Date: Sun Nov 19 21:58:06 2006

Michael Sperber scripsit:

> I'm probably missing something, but where does it say that? Note that
> the definition of `eqv?' says that = on numbers of the same exactness
> implies eqv?, but that the same is not true for the case that = does
> not hold: As far as I can see, `(eqv? +nan.0 +nan.0)' is unspecified
> per the wording in the draft.

The draft provides two alternative criteria for deciding if numbers
are not eqv?. If = returns #f and the numbers are rational, or if
the numbers are discernible by Scheme's standard arithmetic procedures.
The first criterion maps rational inequality onto non-eqv?-ness;
the second criterion works for irrational or complex numbers,
as well as distinguishing a NaN from any other number.

So you are right that (eqv? +nan.0 +nan.0) is unspecified, but it's
hardly obvious: it depends on noticing the word "rational" in the
first criterion.

-- 
Only do what only you can do.               John Cowan <cowan_at_ccil.org>
  --Edsger W. Dijkstra's advice
    to a student in search of a thesis
Received on Sun Nov 19 2006 - 21:58:02 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC