diff --git a/pkgs/racket-test-core/tests/racket/math.rktl b/pkgs/racket-test-core/tests/racket/math.rktl index 99679c5c1b..264e7de9da 100644 --- a/pkgs/racket-test-core/tests/racket/math.rktl +++ b/pkgs/racket-test-core/tests/racket/math.rktl @@ -340,7 +340,11 @@ (test 0.0f0 tanh 0.0f0) (test #t single=? tanh+1 (tanh 1.0f0)) (test 1.0f0 tanh 20.0f0) - (test 1.0f0 tanh +inf.f)) + (test 1.0f0 tanh +inf.f) + (test #t single-flonum? (tanh -0.11100646f0)) + (test #t single-flonum? (tanh 0.11100646f0)) + (test #t single-flonum? (tanh 0.61100646f0)) + (test #t single-flonum? (tanh 20.61100646f0))) (test +nan.0 tanh +nan.0) (test -1.0 tanh -inf.0) diff --git a/racket/collects/racket/math.rkt b/racket/collects/racket/math.rkt index c2c03b0faf..2f470151ad 100644 --- a/racket/collects/racket/math.rkt +++ b/racket/collects/racket/math.rkt @@ -85,7 +85,7 @@ (define R (/ (* g (+ (* (+ (* p2 g) p1) g) p0)) (+ (* (+ (* (+ g q2) g) q1) g) q0))) - (+ z (* z R))] + (+ z (* z (if (single-flonum? z) (real->single-flonum R) R)))] [(z . < . 19.06154746539849600897D+00) (- 1 (/ 2 (+ 1 (exp (* 2 z)))))] [(z . >= . 19.06154746539849600897D+00) (if (single-flonum? z) (real->single-flonum 1.0) 1.0)] [else z]))] ; +nan.0 or +nan.f