Implementation of read-ieee-float64 Bradley Lucier (07 Dec 2005 05:01 UTC)
Re: Implementation of read-ieee-float64 Alex Shinn (09 Dec 2005 03:12 UTC)
Re: Implementation of read-ieee-float64 Bradley Lucier (09 Dec 2005 05:21 UTC)
Re: Implementation of read-ieee-float64 Marc Feeley (09 Dec 2005 14:27 UTC)
Re: Implementation of read-ieee-float64 Bradley Lucier (09 Dec 2005 19:51 UTC)

Implementation of read-ieee-float64 Bradley Lucier 07 Dec 2005 05:01 UTC

In the implementation of the withdrawn SRFI-56, read-ieee-float64 has
the following code

     (define (mantissa expn b2 b3 b4 b5 b6 b7 b8)
       (case expn   ; recognize special literal exponents
         ((255) #f) ; won't handle NaN and +/- Inf
         ((0)       ; denormalized
          (exact->inexact (* (expt 2.0 (- 1 (+ 1023 52)))
                             (combine b2 b3 b4 b5 b6 b7 b8))))
         (else
          (exact->inexact
           (* (expt 2.0 (- expn (+ 1023 52)))
              (combine (+ b2 16) b3 b4 b5 b6 b7 b8))))))

Gambit 4.0b15 fails some srfi-56 tests because the first instance of
2.0 is not 2; unfortunately, Gambit-C calculates

(expt 2.0 -1074)

as

(/ (expt 2.0 1074))

Since the exponent range of IEEE arithmetic is not symmetric, (expt
2.0 1074) is +inf.0, yet (expt 2.0 -1074) is not 0.

If both instances of 2.0 are changed to 2, then Gambit passes all the
tests.  I think that this is what you may have meant in the first
place, because you take the trouble to call exact->inexact on what is
already an inexact number.

Brad