[oct-scm] [oct-git]OCT: A portable Lisp implementation for quad-double precision floats branch master updated. 5daefcc43f8b88741634f7a982bdb8b976739a1c

Raymond Toy rtoy at common-lisp.net
Thu Apr 12 21:37:59 UTC 2012


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 "OCT:  A portable Lisp implementation for quad-double precision floats".

The branch, master has been updated
       via  5daefcc43f8b88741634f7a982bdb8b976739a1c (commit)
       via  235ac2e4756b7c3f03815b267d292a26e8e1df37 (commit)
      from  0823acf49a91cbdb9a3e7f1faae2efe128580038 (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 5daefcc43f8b88741634f7a982bdb8b976739a1c
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Thu Apr 12 14:37:38 2012 -0700

    Enable test of complex args.

diff --git a/rt-tests.lisp b/rt-tests.lisp
index 29a6501..712b96c 100644
--- a/rt-tests.lisp
+++ b/rt-tests.lisp
@@ -1673,10 +1673,9 @@
   nil)
 
 ;; Bessel J for complex args
-#+nil
 (rt:deftest bessel-j-complex.pos-order.d.1
     (let ((b (bessel-j 0d0 #c(1d0 1)))
 	  (true #c(0.9376084768060293d0 -0.4965299476091221d0)))
-      (check-accuracy 53 b true))
+      (check-accuracy 50.73 b true))
   nil)
 

commit 235ac2e4756b7c3f03815b267d292a26e8e1df37
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Thu Apr 12 14:37:27 2012 -0700

    Fix for complex args.

diff --git a/qd-bessel.lisp b/qd-bessel.lisp
index fb02f75..0c06f8a 100644
--- a/qd-bessel.lisp
+++ b/qd-bessel.lisp
@@ -183,18 +183,18 @@
 (defun integer-bessel-j-exp-arc (v z)
   (let* ((iz (* #c(0 1) z))
 	 (i+ (exp-arc-i-2 iz v)))
-    (cond ((= v (ftruncate v))
+    (cond ((and (= v (ftruncate v)) (realp z))
 	   ;; We can simplify the result
-	   (let ((c (cis (* v (float-pi i+) -1/2))))
+	   (let ((c (exp (* v (float-pi i+) #c(0 -1/2)))))
 	     (/ (+ (* c i+)
 		   (* (conjugate c) (conjugate i+)))
 		(float-pi i+)
 		2)))
 	  (t
 	   (let ((i- (exp-arc-i-2 (- iz ) v)))
-	     (/ (+ (* (cis (* v (float-pi i+) -1/2))
+	     (/ (+ (* (exp (* v (float-pi i+) #c(0 -1/2)))
 		      i+)
-		   (* (cis (* v (float-pi i+) 1/2))
+		   (* (exp (* v (float-pi i+) #c(0 1/2)))
 		      i-))
 		(float-pi i+)
 		2))))))
@@ -394,19 +394,21 @@
     ;; Clear the caches for now.
     (an-clrhash)
     (%big-a-clrhash)
-    (cond ((= vv v)
-	   ;; v is an integer
+    (cond ((and (= vv v) (realp z))
+	   ;; v is an integer and z is real
 	   (integer-bessel-j-exp-arc v z))
 	  (t
 	   ;; Need to fine-tune the value of big-n.
 	   (let ((big-n 100)
 		 (vpi (* v (float-pi (realpart z)))))
 	     (+ (integer-bessel-j-exp-arc v z)
-		(* z
-		   (/ (sin vpi) vpi)
-		   (+ (/ -1 z)
-		      (sum-ab big-n v z)
-		      (sum-big-ia big-n v z)))))))))
+		(if (= vv v)
+		    0
+		    (* z
+		       (/ (sin vpi) vpi)
+		       (+ (/ -1 z)
+			  (sum-ab big-n v z)
+			  (sum-big-ia big-n v z))))))))))
 
 ;; Bessel Y
 ;;

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

Summary of changes:
 qd-bessel.lisp |   24 +++++++++++++-----------
 rt-tests.lisp  |    3 +--
 2 files changed, 14 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
OCT:  A portable Lisp implementation for quad-double precision floats




More information about the oct-cvs mailing list