[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Formal Objection: Memoization is not possible in portable R7RS

On 11/25/2012 05:48 PM, John Cowan wrote:
> Per Bothner scripsit:
>> IMO this does the wrong thing if you have two different NaN values,
>> as allowed by IEEE.  Neither is numerically equal to itself,
>> but they have different bit-patterns, and eqv? should compare
>> them as false.
> That conclusion has always seemed metaphysical to me.  Why should
> they be compared as false?  There is no standard Scheme procedure that
> can distinguish them.  Only deliberate abstraction-breakers like CL's
> `decode-float` can do so.

> In any case, there is the pragmatic issue that some Schemes follow R5RS
> and say that two NaNs are never `eqv?` (because they are never `=`), and
> others do not.

OK, leaving it unspecified seems reasonable.

>  I can't tell which ones use a "same-bits" approach and
> which ones do something different, because I don't know a consistent way
> to generate NaNs with distinct bit patterns that works across all Schemes.
> If anyone knows how to do so on an x86 (32 bit) Linux box, I would like
> to know about it.

Using R6RS's bytevector-ieee-single-native-ref should work for those
implementations that support it.  But of course many don't. (Kawa doesn't.)
Perhaps that's something to consider for the Large language.
	--Per Bothner
per@x   http://per.bothner.com/

Scheme-reports mailing list