comments on latest draft William D Clinger (04 Jun 2017 05:35 UTC)
Re: comments on latest draft William D Clinger (05 Jun 2017 18:39 UTC)
Re: comments on latest draft William D Clinger (07 Jun 2017 03:50 UTC)
Re: comments on latest draft Bradley Lucier (07 Jun 2017 19:55 UTC)
Re: comments on latest draft William D Clinger (07 Jun 2017 23:25 UTC)
Re: comments on latest draft Bradley Lucier (08 Jun 2017 01:09 UTC)
Re: comments on latest draft William D Clinger (09 Jun 2017 15:19 UTC)
Re: comments on latest draft Bradley Lucier (09 Jun 2017 17:11 UTC)
Re: comments on latest draft Bradley Lucier (09 Jun 2017 17:18 UTC)

Re: comments on latest draft William D Clinger 09 Jun 2017 15:19 UTC

Bradley Lucier wrote:

> I think your implementation of fl+* may not do what you want (what
> does (exact x) return when x is an infinity or NaN?).
>
> This page
>
> http://en.cppreference.com/w/c/numeric/math/fma
>
> covers the various situations where the arguments are infinities or NaNs.

Thank you.

> It’s not pretty …

It seldom is.  But I think the following definition is correct:

(define fl+*
  (flop3 'fl+*
         (lambda (x y z)
           (cond ((and (flfinite? x) (flfinite? y) (flfinite? z))
                  (let ((x (exact x))
                        (y (exact y))
                        (z (exact z)))
                    (flonum (+ (* x y) z))))
                 (else
                  (fl+ (fl* x y) z))))))

I have modified the portable implementation of SRFI 144 so it should work
without modification in any complete implementation of R7RS small.

Larceny v0.99 fails 6 of the 1102 tests I've written for SRFI 144 so far.
All of those failures are caused by bugs in Larceny, which I have corrected
in the development version of Larceny.

Sagittarius 0.8.4 fails 8 of the 1102 tests.  Those failures are caused by
a rounding error in inexact plus two minor bugs: (finite? +nan.0) returns
true, contrary to R7RS small, and (fl 0.0) raises an exception instead of
returning an infinity or NaN.

Although the portable implementation does not yet include the Bessel or
error functions (to arrive next week), it does prove SRFI 144 can be
implemented portably without relying on an FFI.

(That statement excludes flinteger-exponent, which can't be implemented
at all, even with an FFI.)

Will