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

From: Aubrey Jaffer <agj>
Date: Fri Nov 24 16:37:29 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.
Received on Fri Nov 24 2006 - 16:34:55 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC