[libmath-prime-util-perl] 02/13: Change exp2 to pow, and incorporate inverse into exponent

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:45:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.11
in repository libmath-prime-util-perl.

commit f440ed15d071cdfc844fce29be344c347aac62dc
Author: Dana Jacobsen <dana at acm.org>
Date:   Wed Jul 18 09:33:21 2012 -0500

    Change exp2 to pow, and incorporate inverse into exponent
---
 util.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/util.c b/util.c
index a5d923a..1e8a152 100644
--- a/util.c
+++ b/util.c
@@ -768,14 +768,11 @@ static double evaluate_zeta(double x) {
    */
 
   /* term = 1.0;          y = term-c;  t = sum+y;  c = (t-sum)-y;  sum = t; */
-  term = 1.0/exp2(x);  y = term-c;  t = sum+y;  c = (t-sum)-y;  sum = t;
+  term = pow(2, -x);  y = term-c;  t = sum+y;  c = (t-sum)-y;  sum = t;
 
   for (k = 3; k <= 100000; k++) {
     if (fabs(term) < tol) break;
-    if      (k ==  4) term = 1.0 / exp2(2*x);
-    else if (k ==  8) term = 1.0 / exp2(4*x);
-    else if (k == 16) term = 1.0 / exp2(8*x);
-    else              term = 1.0 / pow(k, x);
+    term = pow(k, -x);
     y = term-c;  t = sum+y;  c = (t-sum)-y;  sum = t;
   }
   return sum;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list