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

Raymond Toy rtoy at common-lisp.net
Fri Mar 23 05:58:49 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  fe8cffb5ee8e7161addf7586ecaee00682c6bf1b (commit)
      from  e10e402d446339130042607357b0129b35a1faa7 (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 fe8cffb5ee8e7161addf7586ecaee00682c6bf1b
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Thu Mar 22 22:58:43 2012 -0700

    Clean up implemenation of s-exp-integral-e a bit.

diff --git a/qd-gamma.lisp b/qd-gamma.lisp
index 13f0bd9..e353ff5 100644
--- a/qd-gamma.lisp
+++ b/qd-gamma.lisp
@@ -497,18 +497,19 @@
     (if (and (realp v)
 	     (= v (ftruncate v)))
 	;; v is an integer
-	(let ((n (truncate v)))
-	  (- (* (/ (expt -z (- v 1))
+	(let* ((n (truncate v))
+	       (n-1 (1- n)))
+	  (- (* (/ (expt -z n-1)
 		   (gamma v))
 		(- (psi v) (log z)))
 	     (loop for k from 0
-		       for term = 1 then (* term (/ -z k))
-		   for sum = (/ (- 1 v)) then (+ sum (let ((denom (+ k 1 (- n))))
+		   for term = 1 then (* term (/ -z k))
+		   for sum = (/ (- 1 v)) then (+ sum (let ((denom (- k n-1)))
 						       (if (zerop denom)
 							   0
-							   (/ term (+ k 1 -v)))))
-		       when (< (abs term) (* (abs sum) eps))
-			 return sum)))
+							   (/ term denom))))
+		   when (< (abs term) (* (abs sum) eps))
+		     return sum)))
 	(loop for k from 0
 	      for term = 1 then (* term (/ -z k))
 	      for sum = (/ (- 1 v)) then (+ sum (/ term (+ k 1 -v)))

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

Summary of changes:
 qd-gamma.lisp |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)


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




More information about the oct-cvs mailing list