[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Proposed language for 'eqv?' applied to inexact real numbers



Hi Noah,

Noah Lavine <noah.b.lavine@x> writes:
>     The 'eqv?' predicate on two elements of S must return #t if its
> arguments are the same member of S, and #f otherwise. Note that a
> single member of S may have different representations, but arithmetic
> operations are defined on the abstract set S and not on the
> representations."
>
> The goal is basically to push parts of the definition of eqv? down to
> implementations, but do it in a structured way. This would require
> that (eqv? 1.0 1.0) => #t,

It is a mistake to try to ensure that (eqv? x y) => #true when x and y
represent the same numeric value in different representations.  You are
trying to make 'eqv?' act like '=', and that is a fundamental error, and
a very common one.

Since we all agree that (eqv? 0 0.0) => #false, it is already not useful
as a numerical equality test, so please stop trying to make it one.  It
will never do that job properly, and you will only destroy its ability
to do the one important job that it is good at.

'eqv?' has an entirely different purpose, and that is to determine
whether two objects are known to be operationally equivalent.
Admittedly, the precise definition of "operationally equivalent" is
difficult to formalize.  Nonetheless that is the basic idea, and that
has _always_ been the case since it was first introduced in the RRRS.

The RRRS defined 'eqv?' on inexact numbers as follows (this is actually
from its definition of 'eq?', but 'eqv?' was defined as being the same
as 'eq?' for inexact numbers):

http://dspace.mit.edu/bitstream/handle/1721.1/5600/AIM-848.pdf (page 24)

   "Returns #!true if obj1 is identical in all respects to obj2,
    otherwise returns #!false.  If there is any way at all that a user
    can distinguish obj1 and obj2, then eq? will return #!false."

It is a shame that the R4RS and R5RS stopped explaining the concept
behind 'eqv?' that was so clearly explained in the RRRS and R3RS.  The
result is that the current generation of Scheme hackers have apparently
forgotten what 'eqv?' is for.

     Mark

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports