[libmath-prime-util-perl] 03/50: Call GMP prime_count if available

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


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

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

commit 105da77ad56591bd2c02b4638b890ba4f31a8c81
Author: Dana Jacobsen <dana at acm.org>
Date:   Tue Jul 24 11:01:54 2012 -0600

    Call GMP prime_count if available
---
 Changes                |  2 +-
 Makefile.PL            | 11 +++++++----
 lib/Math/Prime/Util.pm |  4 +++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Changes b/Changes
index 358dd09..84002fa 100644
--- a/Changes
+++ b/Changes
@@ -6,7 +6,7 @@ Revision history for Perl extension Math::Prime::Util.
       used for integers > 40 before).
 
 0.11  23 July 2012
-    - Turn of threading tests on Cygwin, as threads on some Cygwin platforms
+    - Turn off threading tests on Cygwin, as threads on some Cygwin platforms
       give random panics (my Win7 64-bit works fine, XP 32-bit does not).
     - Use pow instead of exp2 -- some systems don't have exp2.
     - Fix compile issues on MSC, thanks to Sisyphus.
diff --git a/Makefile.PL b/Makefile.PL
index cba57a3..7994601 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -14,9 +14,10 @@ WriteMakefile1(
                     'XS.o',
     LIBS         => ['-lm'],
 
-    BUILD_REQUIRES => {
-                    'Test::More'       => '0.45',
-                      },
+    BUILD_REQUIRES=>{
+                      'Test::More'       => '0.45',
+                      'bignum'           => '0.23',   # Used for bigint tests
+                    },
     PREREQ_PM    => {
                       'Exporter'         => '5.562',
                       'XSLoader'         => '0.01',
@@ -24,10 +25,12 @@ WriteMakefile1(
                       'Tie::Array'       => 0,
                       'base'             => 0,
                       'Config'           => 0,
-                      'bignum'           => '0.23',   # Used for bigint tests
                       'Math::BigInt'     => '1.88',
                       'Math::BigFloat'   => '1.59',
                     },
+    META_MERGE   => {
+                      recommends => { 'Math::Prime::Util::GMP' => 0.04, },
+                    },
 
     MIN_PERL_VERSION => 5.006002,
 );
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index b941e38..b1eb9c1 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -162,7 +162,7 @@ sub _validate_positive_integer {
   1;
 }
 
-# It you use bigint then call one of the approx/bounds/math functions, you'll
+# If you use bigint then call one of the approx/bounds/math functions, you'll
 # end up with full bignum turned on.  This seems non-optimal.  However, if I
 # don't do this, then you'll get wrong results and end up with it turned on
 # _anyway_.  As soon as anyone does something like log($n) where $n is a
@@ -784,6 +784,8 @@ sub prime_count {
   return 0 if $high < 2  ||  $low > $high;
 
   return _XS_prime_count($low,$high) if $high <= $_XS_MAXVAL;
+  return Math::Prime::Util::GMP::prime_count($low,$high) if $_HAVE_GMP
+                       && defined &Math::Prime::Util::GMP::prime_count;
   return Math::Prime::Util::PP::prime_count($low,$high);
 }
 

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