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

Raymond Toy rtoy at common-lisp.net
Wed Apr 11 03:36:18 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  104efdeae6ef52c5d370e0b3a048a5087cdb1ea2 (commit)
      from  e9cd1a46fcf2a5c0101b3473648cb242b55987e8 (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 104efdeae6ef52c5d370e0b3a048a5087cdb1ea2
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Tue Apr 10 20:36:11 2012 -0700

    VALUE-OR-TINY returned a value that was too tiny.
    
     * qd-gamma.lisp::
       * Return sqrt(least-positive-normalized-double) instead of
         least-positive-normalized-double.
     * rt-tests.lisp::
       * Add test for this case.

diff --git a/qd-gamma.lisp b/qd-gamma.lisp
index 25fa38e..40a45eb 100644
--- a/qd-gamma.lisp
+++ b/qd-gamma.lisp
@@ -216,9 +216,9 @@
 		   (incf tiny-value-count)
 		   (etypecase v
 		     ((or double-float cl:complex)
-		      least-positive-normalized-double-float)
+		      (sqrt least-positive-normalized-double-float))
 		     ((or qd-real qd-complex)
-		      (make-qd least-positive-normalized-double-float))))
+		      (make-qd (sqrt least-positive-normalized-double-float)))))
 		 v)))
       (let* ((f (value-or-tiny (funcall bf 0)))
 	     (c f)
@@ -241,7 +241,7 @@
 		  (setf d (/ d))
 		  (setf f (* f delta))
 		  (when *debug-cf-eval*
-		    (format t "  dl= ~S~%" delta)
+		    (format t "  dl= ~S (|dl - 1| = ~S)~%" delta (abs (1- delta)))
 		    (format t "  f = ~S~%" f))
 		  (when (<= (abs (- delta 1)) eps)
 		    (return-from lentz (values f j tiny-value-count)))))
diff --git a/rt-tests.lisp b/rt-tests.lisp
index 0544ea8..192b118 100644
--- a/rt-tests.lisp
+++ b/rt-tests.lisp
@@ -1234,6 +1234,16 @@
        append (list (list (list k m) result)))
   nil)
 
+(rt:deftest lentz
+    ;; This isn't really a test of cf-incomplete-gamma.  It's a test
+    ;; that Lentz's algorithm works in this case.  For these args,
+    ;; cf-incomplete-gamma used to generate an overflow or division by
+    ;; zero because value-or-tiny was too tiny.
+    (let ((g (cf-incomplete-gamma 3d0 5d0))
+	  (true (- 2 (* 37 (exp -5d0)))))
+      (check-accuracy 53 g true))
+  nil)
+
 (rt:deftest gamma.1.d
     (let ((g (gamma 0.5d0))
 	  (true (sqrt pi)))

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

Summary of changes:
 qd-gamma.lisp |    6 +++---
 rt-tests.lisp |   10 ++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)


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




More information about the oct-cvs mailing list