log1pexp(x) is never exactly x even if that's the best approximation.
authorTaylor R Campbell <campbell@mumble.net>
Sat, 27 Oct 2018 02:11:14 +0000 (02:11 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Sat, 27 Oct 2018 02:11:14 +0000 (02:11 +0000)
src/runtime/arith.scm

index ebe1e0ac4383eb5fb4a5a148bee01fe2dedd69bc..ee2d0471f91f2bbaf5cc8ea74ed830f16a6235e1 100644 (file)
@@ -2029,7 +2029,7 @@ USA.
        ((<= x flo:log-epsilon) (exp x))
        ((<= x 18) (log1p (exp x)))
        ((<= x 33.3) (+ x (exp (- x))))
-       (else x)))
+       (else (exact->inexact x))))
 
 ;;; Lemma 1.  If |d'| < 1/2, then |(d' - d)/(1 + d')| <= 2|d' - d|.
 ;;;