Version 1 (modified by cowan, 5 years ago) (diff) |
---|

## Proposed R7RS definition for `eqv?` on numbers

[See #477 for detailed background and rationale]

Objects *obj _{1}* and

*obj*are

_{2}*substantially different*if and only if one of the following holds:

*Obj*and_{1}*obj*are both numbers, at least one is numerically equal to itself (see_{2}`=`), and they are not numerically equal (see`=`) to each other.

*Obj*and_{1}*obj*are not both numbers, and they are different (in the sense of_{2}`eqv?`).

Inexact numbers *z _{1}* and

*z*are

_{2}*operationally equivalent*if and only if for all procedures

*f*that can be defined as a finite composition of the standard numerical operations specified in section 6.2.6,

`(f z1)`and

`(f z2)`either both raise exceptions or yield results that are not substantially different.

The `eqv?` procedure returns `#t` if one of the following holds:

[...]

*Obj*and_{1}*obj*are both exact numbers and are numerically equal (see_{2}`=`).

*Obj*and_{1}*obj*are both inexact numbers, at least one is numerically equal to itself (see_{2}`=`), and the implementation is able to prove that*obj*and_{1}*obj*are operationally equivalent. Implementations must be able to prove that two inexact numbers with the same internal representation are operationally equivalent._{2}

The `eqv?` procedure returns `#f` if one of the following holds:

[...]

- One of
*obj*and_{1}*obj*is an exact number but the other is an inexact number._{2}

*Obj*and_{1}*obj*are exact numbers for which the_{2}`=`procedure returns`#f`.

*Obj*and_{1}*obj*are inexact numbers, at least one is numerically equal to itself (see_{2}`=`), and the implementation is unable to prove that*obj*and_{1}*obj*are operationally equivalent._{2}