Raymond Toy pushed to branch issue-314-complex-tanh-incorrect-for-large-arg at cmucl / cmucl
Commits: e028381e by Raymond Toy at 2024-05-10T09:08:48-07:00 Fix the same tanh issue in irrat-dd.lisp.
The double-double version of complex-tanh has exactly the same problem. Apply the fix too.
- - - - - 22cfda6d by Raymond Toy at 2024-05-10T09:09:26-07:00 Add tests for tanh of large double-double floats too.
- - - - -
2 changed files:
- src/code/irrat-dd.lisp - tests/irrat.lisp
Changes:
===================================== src/code/irrat-dd.lisp ===================================== @@ -1800,12 +1800,10 @@ Z may be any number, but the result is always a complex." (declare (optimize (speed 3) (space 0) (inhibit-warnings 3))) (cond ((> (abs x) - #-(or linux hpux) #.(/ (%asinh most-positive-double-float) 4d0) - ;; This is more accurate under linux. - #+(or linux hpux) #.(/ (+ (%log 2.0d0) - (%log most-positive-double-float)) 4d0)) + ;; Don't need double-double accuracy here. + #.(/ (%asinh most-positive-double-float) 4d0)) (complex (float-sign x) - (float-sign y))) + (float-sign y 0w0))) (t (let* ((tv (dd-%tan y)) (beta (+ 1.0d0 (* tv tv)))
===================================== tests/irrat.lisp ===================================== @@ -239,4 +239,9 @@ (tanh #c(200d0 -200d0))) (assert-eql (complex 1d0 +0d0) (tanh #c(200d0 +200d0))) + (assert-eql (complex 1w0 -0w0) + (tanh #c(200w0 -200w0))) + (assert-eql (complex 1w0 +0w0) + (tanh #c(200w0 200w0)))) +
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/cd8e60037f2de0e8f3dedc5...