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

John Cowan cowan at ccil.org
Wed Sep 20 14:31:45 EDT 2006


Per Bothner scripsit:

> Agreed.  I'd argue for "#t iff the bit patterns being compared are the
> same".  Not necessarily that R6RS shoudl require this, but it might
> suggest/recommend this for implementations using IEEE floating-point.

So for the purposes of the standard, we are agreed that eqv? on a NaN
and another flonum may return either #t or #f?  That is the status quo,
since eqv? may return #t where = would return #f.

> >The former method works, but the latter does not:  given two Doubles
> >representing NaNs, Double.equals will return false.
> 
> That is incorrect:
> 
> $ bin/kawa
> #|kawa:1|# (define NaN java.lang.Double:NaN)
> #|kawa:2|# (NaN:equals NaN)
> #t

Quite right; there was a bug in my code.

-- 
John Cowan      cowan at ccil.org        http://www.ccil.org/~cowan
        Is it not written, "That which is written, is written"?



More information about the r6rs-discuss mailing list