[cmucl-commit] [git] CMU Common Lisp branch rtoy-lisp-trig updated. snapshot-2013-12-a-7-g36403a8

Raymond Toy rtoy at common-lisp.net
Sun Dec 15 07:05:45 UTC 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, rtoy-lisp-trig has been updated
       via  36403a831c9a979d5a16d1249000b85d4c8c6bfc (commit)
      from  7069ef9dfa3770d7b3e00aac297ae7dcb22b8c20 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 36403a831c9a979d5a16d1249000b85d4c8c6bfc
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Sat Dec 14 23:05:34 2013 -0800

    Correct bug in tan.
    
     * code/irrat.lisp
       * Fix typo in kernel-tan.
     * tests/trig.lisp
       * Add test case.

diff --git a/src/code/irrat.lisp b/src/code/irrat.lisp
index 6a025a1..4dc7773 100644
--- a/src/code/irrat.lisp
+++ b/src/code/irrat.lisp
@@ -489,11 +489,11 @@
 			   r))))))))
     (when (= iy 1)
       (return-from kernel-tan w))
-    ;;
+    ;; Compute 1/w=1/(x+r) carefully
     (let ((a 0d0)
 	  (tt 0d0))
       (setf z (kernel:make-double-float (kernel:double-float-high-bits w) 0))
-      (setf v (- r (- r x)))		; z + v = r + x
+      (setf v (- r (- z x)))		; z + v = r + x
       (setf a (/ -1 w))
       (setf tt (kernel:make-double-float (kernel:double-float-high-bits a) 0))
       (setf s (+ 1 (* tt z)))
diff --git a/src/tests/trig.lisp b/src/tests/trig.lisp
index 9555b11..57a5355 100644
--- a/src/tests/trig.lisp
+++ b/src/tests/trig.lisp
@@ -127,6 +127,12 @@
     (tan (float 11/16 1d0))
   8.21141801589894121911423965374711700875371645309d-1)
 
+(rt:deftest tan.6
+    ;; This was found by maxima's testsuite.  A bug in kernel-tan when
+    ;; returning cot(x).
+    (tan 1.107148717794091d0)
+  2.0000000000000028604455051971538975562294147582d0)
+
 (rt:deftest tan.red.0
     ;; Test for argument reduction with n even
     (tan (* 7/4 pi))

-----------------------------------------------------------------------

Summary of changes:
 src/code/irrat.lisp |    4 ++--
 src/tests/trig.lisp |    6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp


More information about the cmucl-commit mailing list