[libmath-prime-util-perl] 09/20: Minor updates

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


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

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

commit a48fe49a5cf4a94c2fba0e5a4df4ab2134d37384
Author: Dana Jacobsen <dana at acm.org>
Date:   Fri Mar 1 01:32:27 2013 -0800

    Minor updates
---
 factor.c                  |  6 +++---
 lib/Math/Prime/Util/PP.pm | 14 ++++++--------
 util.c                    |  2 +-
 xt/primality-small.pl     |  2 +-
 4 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/factor.c b/factor.c
index d2da1d9..b86b02b 100644
--- a/factor.c
+++ b/factor.c
@@ -360,13 +360,13 @@ int _XS_is_prob_prime(UV n)
   }
 #else
 #if 1
-  /* Better bases from http://miller-rabin.appspot.com/, 23 Feb 2013 */
+  /* Better bases from http://miller-rabin.appspot.com/, 28 Feb 2013 */
   if (n < UVCONST(291831)) {
     bases[0] = UVCONST(126401071349994536);
     nbases = 1;
-  } else if (n < UVCONST(520924141)) {
+  } else if (n < UVCONST(624732421)) {
     bases[0] = 15;
-    bases[1] = UVCONST( 750068417525532 );
+    bases[1] = UVCONST( 5511855321103177 );
     nbases = 2;
   } else if (n < UVCONST(154639673381)) {
     bases[0] = 15;
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index feeb506..21e7679 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -712,7 +712,7 @@ sub miller_rabin {
   return 0 if !($n % 2);
 
   # Die on invalid bases
-  do { croak "Base $_ is invalid" if $_ < 2 } for (@bases);
+  foreach my $base (@bases) { croak "Base $base is invalid" if $base < 2 }
   # Make sure we handle big bases ok.
   @bases = grep { $_ > 1 }  map { ($_ >= $n) ? $_ % $n : $_ }  @bases;
 
@@ -948,14 +948,12 @@ sub is_strong_lucas_pseudoprime {
 
 my $_poly_bignum;
 sub _poly_new {
-  my @poly;
+  my @poly = @_;
+  push @poly, 0 unless scalar @poly;
   if ($_poly_bignum) {
-    foreach my $c (@_) {
-      push @poly, (ref $c eq 'Math::BigInt') ? $c->copy : Math::BigInt->new("$c");
-    }
-  } else {
-    push @poly, $_ for (@_);
-    push @poly, 0 unless scalar @poly;
+    @poly = map { (ref $_ eq 'Math::BigInt')
+                  ?  $_->copy
+                  :  Math::BigInt->new("$_"); } @poly;
   }
   return \@poly;
 }
diff --git a/util.c b/util.c
index e6f2bfa..3048e69 100644
--- a/util.c
+++ b/util.c
@@ -664,7 +664,7 @@ IV* _moebius_range(UV lo, UV hi)
     if (i < lo)
       i = i*(lo/i) + ( (lo%i) ? i : 0 );
     while (i <= hi) {
-      mu[i-lo] *= -p;
+      mu[i-lo] *= -(IV)p;
       i += p;
     }
   }
diff --git a/xt/primality-small.pl b/xt/primality-small.pl
index dbed6ff..8491a31 100755
--- a/xt/primality-small.pl
+++ b/xt/primality-small.pl
@@ -5,7 +5,7 @@ $| = 1;  # fast pipes
 
 # Make sure the is_prob_prime functionality is working for small inputs.
 # Good for making sure the first few M-R bases are set up correctly.
-my $limit = 600_000_000;
+my $limit = 800_000_000;
 
 use Math::Prime::Util qw/is_prob_prime/;
 # Use another code base for comparison.

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