fl+* in gambit-lib/srfi/276.sld
Bradley Lucier 01 Nov 2026 17:28 UTC
Peter:
Gambit doesn't use the C library fma anywhere. Github head uses the
relatively slow code
https://github.com/gambit/gambit/blob/f1c787a000fbb50132af79a1bdf6c7610d430c9b/lib/_num.scm#L12716
which works on the Javascript and Python back ends, too. So I don't
understand the code in gambit-lib/srfi/276.sld where the value of
fl-fast-fl+* depends on C's FP_FAST_FMA. I'd say that fast-fl+* should
probably be false on Gambit.
The most recent release 4.9.8 has the buggy version
(define-prim&proc (fl+* (x flonum)
(y flonum)
(z flonum))
(if (and (flfinite? x) (flfinite? y))
(if (flfinite? z)
(let ((x (exact x))
(y (exact y))
(z (exact z)))
(inexact (+ (* x y) z)))
z)
(fl+ (fl* x y) z)))
which may be why you needed to redefine fl+* in gambit-lib/srfi/276.sld,
but I don't think it's because of musl.
Brad