The history of EQV? on numbers

10 views

John Cowan

Mar 23, 2012, 5:26:35 PM3/23/12
In R2RS, exact numbers are eqv? if they are =. All other cases are
implementation-defined.

In R3RS, a notion of operational equivalence is defined, and numbers
are operationally equivalent (and therefore eqv?) iff they are = and
have the same exactness.

In R4RS, the notion of operational equivalence is dropped, and eqv? is
directly defined on numbers in the same way as in R3RS.

R5RS continues R4RS.

In R6RS, operational equivalence is restored as the criterion, though
the name is not used. Rational numbers are eqv? iff they are = and
have the same exactness. Otherwise, they are eqv? if they are =;
they are not eqv? if they are operationally distinguishable or have
different exactness. They are indeterminate otherwise.

In R7RS draft 6, numbers are eqv? iff they are = and have the
same exactness, except that if one of them is +nan.0 the result is
indeterminate.

--
"The serene chaos that is Courage, and the phenomenon co...@ccil.org
of Unopened Consciousness have been known to the John Cowan
Great World eons longer than Extaboulism."
"Why is that?" the woman inquired.
"Because I just made that word up", the Master said wisely.
--Kehlog Albran, The Profit http://www.ccil.org/~cowan

Mar 23, 2012, 8:48:16 PM3/23/12

On Mar 23, 2012, at 5:26 PM, John Cowan wrote:

> In R6RS, operational equivalence is restored as the criterion, though
> the name is not used. Rational numbers are eqv? iff they are = and
> have the same exactness. Otherwise, they are eqv? if they are =;
> they are not eqv? if they are operationally distinguishable or have
> different exactness. They are indeterminate otherwise.

Here is what R6RS says about eqv?

5.10 Storage model

An object fetched from a location, by a variable reference or by a procedure such as car, vector-ref, or string-ref, is equivalent in the sense of eqv? (section 11.5) to the object last stored in the location before the fetch.

<commentary>

So

(let* ((x (/ 0.0 0.0))
(y (cons x x)))
(eqv? x (car y))) => #t

and

(let* ((x (/ 0.0 0.0))
(y (cons x x)))
(eqv? (cdr x) (car y))) => #t

Is there some statement like this in the current draft of R7RS?

This seems to imply that "pointer equality" => "eqv? equality", since

((lambda (x)
(let ((y (cons x x)))
(eqv? x (car y))))
z) => #t

for any object z (even if z is a NaN).

</commentary>