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

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

commit 5f3c9e71175dccad30a5727a0cd4ce7c4b53e03e
Author: Dana Jacobsen <d...@acm.org>
Date:   Mon May 5 14:06:48 2014 -0700

    is_pseudoprime / is_strong_pseudoprime
---
 XS.xs                       | 4 ++--
 lib/Math/Prime/Util/PP.pm   | 1 +
 lib/Math/Prime/Util/PPFE.pm | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/XS.xs b/XS.xs
index 0e21827..b6206ab 100644
--- a/XS.xs
+++ b/XS.xs
@@ -467,7 +467,7 @@ is_strong_pseudoprime(IN SV* svn, ...)
     int c, status = 1;
   PPCODE:
     if (items < 2)
-      croak("No bases given to miller_rabin");
+      croak("No bases given to is_strong_pseudoprime");
     /* Check all arguments */
     for (c = 0; c < items && status == 1; c++)
       if (_validate_int(aTHX_ ST(c), 0) != 1)
@@ -589,7 +589,7 @@ is_prime(IN SV* svn, ...)
       case 6: _vcallsub_with_gmp("is_frobenius_underwood_pseudoprime"); break;
       case 7: _vcallsub_with_gmp("is_aks_prime"); break;
       case 8: _vcallsub_with_gmp("is_power"); break;
-      case 9:_vcallsub_with_gmp("is_pseudoprime"); break;
+      case 9: _vcallsub_with_gmp("is_pseudoprime"); break;
       case 10:
       default:_vcallsub_with_gmp("is_almost_extra_strong_lucas_pseudoprime"); 
break;
     }
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 023d023..ccdf658 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -1561,6 +1561,7 @@ sub is_pseudoprime {
   _validate_positive_integer($n);
 
   if ($n < 5) { return ($n == 2) || ($n == 3) ? 1 : 0; }
+  $base = 2 if !defined $base;
   croak "Base $base is invalid" if $base < 2;
   if ($base >= $n) {
     $base = $base % $n;
diff --git a/lib/Math/Prime/Util/PPFE.pm b/lib/Math/Prime/Util/PPFE.pm
index 6927f80..cac2d4b 100644
--- a/lib/Math/Prime/Util/PPFE.pm
+++ b/lib/Math/Prime/Util/PPFE.pm
@@ -149,14 +149,14 @@ sub is_pseudoprime {
   my($n, $base) = @_;
   return 0 if defined $n && int($n) < 0;
   _validate_positive_integer($n);
-  _validate_positive_integer($base);
+  _validate_positive_integer($base) if defined $base;
   return Math::Prime::Util::PP::is_pseudoprime($n, $base);
 }
 sub is_strong_pseudoprime {
   my($n, @bases) = @_;
   return 0 if defined $n && int($n) < 0;
   _validate_positive_integer($n);
-  croak "No bases given to miller_rabin" unless @bases;
+  croak "No bases given to is_strong_pseudoprime" unless @bases;
   return Math::Prime::Util::PP::is_strong_pseudoprime($n, @bases);
 }
 sub is_lucas_pseudoprime {

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

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to