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

Aubrey Jaffer agj at alum.mit.edu
Fri Nov 24 16:34:55 EST 2006


 | Date: Fri, 24 Nov 2006 14:36:36 -0600
 | From: Alan Watson <alan at alan-watson.org>
 | 
 | Other than using eqv?, how would one distinguish between a single
 | and a double, when both have the same finite value? One could
 | evaluate:
 | 
 |    (eq? (infinite? (+ x FLT_MAX FLT_MAX FLT_MAX))
 |         (infinite? (+ y FLT_MAX FLT_MAX FLT_MAX)))
 | 
 | (where FLT_MAX is the largest finite single).  In a Scheme with
 | singles and doubles that preserved precision, this would indeed
 | yield #f if x and y were of different precisions.

Even a precision-preserving implementation would be within its rights
to return a double from (+ x FLT_MAX FLT_MAX FLT_MAX) because
returning +inf.0 would be a reduction in precision; +inf.0 is very
imprecise.



More information about the r6rs-discuss mailing list