[r6rs-discuss] [Formal] Unclear how equality predicates behave on NaN

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Sep 20 17:09:21 EDT 2006


John Cowan <cowan at ccil.org> writes:

> I don't agree that it's silly:  I think implementations should be
> allowed to adopt any of these.

eqv? which is an equivalence relation is useful. Hash table lookup
or function memoization makes little sense for NaN if the relation
used is not reflexive, and memoization can be wrong if 0.0 is not
distinguished from -0.0.

>> Distinguishing them leads to a simpler implementation: 
>
> Not necessarily. If the implementation language is C, then it
> provides IEEE equality of doubles but does not provide bitwise
> comparison of doubles as values

I meant: if eqv? behaving like = is ruled out, then eqv? comparing bit
representations is simpler to implement than eqv? treating any NaN as
eqv? to any NaN.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/



More information about the r6rs-discuss mailing list