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

From: Per Bothner <per>
Date: Sun Oct 29 14:08:21 2006

John Cowan wrote:
> The fact that (= +nan.0 +nan.0) is #f has unexpected knock-on effects
> on eq? and eqv?.

This is a duplicate.
Look for 'Unclear how equality predicates behave on NaN' in
http://lists.r6rs.org/pipermail/r6rs-discuss/2006-September/thread.html

> I have two alternative proposals:
>
> 1) Allow eqv? and eq? to return either #t or #f if both arguments are NaNs.
> 2) Require eqv? to return #t if both arguments are NaNs.
> eq? would be permitted to return either #t or #f, as with all numbers.

I believe 2 is the correct solution for the "same NaN". If there can be
multiple NaN values (as specified by IEEE) then I think 1 is right, but
2 NaNs that have the type and bit representation should be eqv?.
-- 
	--Per Bothner
per_at_bothner.com   http://per.bothner.com/
Received on Sun Oct 29 2006 - 14:08:44 UTC

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