[r6rs-discuss] [Formal] Unclear how equality predicates behave on NaN
I am posting this as an individual member of the Scheme
community. I am not speaking for the R6RS editors, and
this message should not be confused with the editors'
eventual formal response.
Per Bothner wrote:
> 9.10.2 Numerical operations p 39
> Arithmetic operations
> = explicitly specifies the behavior for +inf.0 and -inf.0, but not
> for +nan.0. Implicitly, if any operand is +nan.0, then the result
> should be #f, and this follows IEEE-754. However, it should be
> stated explicitly.
There are examples of this in section 16.4, but
it would be nice to have an example in 9.10.2 also.
> However, in that case the specification of eqv? (9.6 p 35) is wrong.
> It says that (eqv? x y) implies that (= x y) for numbers.
I don't see that implication in section 9.6.
That section says eqv? returns #t "if" any of
several things are true, and returns #f "if" any
of several other things are true. There is no
"only if" or "if and only if". It looks to me
as though the behavior of eqv? on NaNs is not
specified by section 9.6.
I would argue that the behavior of eqv? on NaNs
should not be fully specified. The basic reason
for this is that the IEEE-754 standard does not
say much about how the bits of a NaN are to be
interpreted, and explicitly allows implementations
of that standard to use most of a NaN's bits to
encode implementation-dependent semantics. The
implementors of a Scheme system will therefore
have a better idea of how eqv? should interpret
those bits than we do.
Will
Received on Tue Sep 19 2006 - 15:17:23 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC