[libmath-prime-util-perl] 07/13: rearrange math to keep precision in some cases

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:45:16 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 77b5fcf0c67b1cf1d0cfa61bad75a1c73b436c2e
Author: Dana Jacobsen <dana at acm.org>
Date:   Sun Jul 22 17:53:59 2012 -0600

    rearrange math to keep precision in some cases
---
 t/13-primecount.t | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/13-primecount.t b/t/13-primecount.t
index 95682c3..475cea7 100644
--- a/t/13-primecount.t
+++ b/t/13-primecount.t
@@ -99,7 +99,10 @@ if ($use64) {
     cmp_ok( prime_count_lower($n), '<=', $pin, "Pi($n) >= lower estimate" );
     my $approx = prime_count_approx($n);
     my $percent_limit = 0.0005;
-    cmp_ok( abs($pin - $approx) / $pin, '<=', $percent_limit/100.0, "prime_count approx($n) within $percent_limit\% of Pi($n)");
+    # This is the test we want:
+    #cmp_ok( abs($pin - $approx) / $pin, '<=', $percent_limit/100.0, "prime_count_approx($n) within $percent_limit\% of Pi($n)");
+    # Math rearranged so we don't lose all precision.
+    cmp_ok( abs($pin - $approx) * (100.0 / $percent_limit), '<=', $pin, "prime_count_approx($n) within $percent_limit\% of Pi($n)");
   }
 }
 

-- 
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