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

From: Per Bothner <per>
Date: Thu Nov 23 16:06:43 2006

Alan Watson wrote:
> Per Bothner wrote:
>> Is there any scenario where you'd want anything other than:
>>
>> (eqv? +nan.0 +nan.0) => #t
>
> If inexacts are unboxed and +nan.0 has only one representation, then the
> implementor can most simply implement eqv? on inexacts with a bitwise
> comparison. In this case, you get #t.
>
> If inexacts are boxed, then the implementor can most simply implement
> eqv? on inexacts with a numerical comparison. In this case, you get #f.

"can most simply implement" != "you would want" or "the right thing".

If inexacts are boxed, then the implementor can easily implement
eqv? on inexacts by comparing their bits.

I think it is important to not break:
   (eq? x x) implies (eqv? x x)
and:
   (let ((x expr)) (eq? x x))
which seems to imply little choice but:
   (eqv? +nan.0 +nan.0) => #t
-- 
	--Per Bothner
per_at_bothner.com   http://per.bothner.com/
Received on Thu Nov 23 2006 - 16:07:41 UTC

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