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

Per Bothner per at bothner.com
Sun Oct 29 14:08:44 EST 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/



More information about the r6rs-discuss mailing list