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

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

commit c3fa258b906b60cb693351623be0ee5e8e80f50a
Author: Dana Jacobsen <d...@acm.org>
Date:   Tue Jan 21 18:39:11 2014 -0800

    Put back some PP validation, as it does bigint magic
---
 factor.c                  | 3 ++-
 lib/Math/Prime/Util/PP.pm | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/factor.c b/factor.c
index 1a22ee8..9ae66b1 100644
--- a/factor.c
+++ b/factor.c
@@ -90,7 +90,8 @@ int factor(UV n, UV *factors)
 
   /* loop over each remaining factor, until ntofac == 0 */
   do {
-    while ( (n >= f*f) && (!_XS_is_prime(n)) ) {
+    //while ( (n >= f*f) && (!_XS_is_prime(n)) ) {
+    while ( (n >= f*f) && (!is_prob_prime(n)) ) {
       int split_success = 0;
       /* Adjust the number of rounds based on the number size */
       UV const br_rounds = ((n>>29) < 100000) ?  1500 :  4000;
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 0dfb83d..bc8440a 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -227,6 +227,8 @@ sub _is_prime7 {  # n must not be divisible by 2, 3, or 5
 
 sub is_prime {
   my($n) = @_;
+  return 0 if int($n) < 0;
+  _validate_positive_integer($n);
 
   if (ref($n) eq 'Math::BigInt') {
     return 0 unless Math::BigInt::bgcd($n, B_PRIM235)->is_one;
@@ -1396,6 +1398,7 @@ sub _is_perfect_power {
 sub is_pseudoprime {
   my($n, $base) = @_;
   return 0 if int($n) < 0;
+  _validate_positive_integer($n);
 
   if ($n < 5) { return ($n == 2) || ($n == 3) ? 1 : 0; }
   croak "Base $base is invalid" if $base < 2;
@@ -1466,6 +1469,8 @@ sub _miller_rabin_2 {
 
 sub is_strong_pseudoprime {
   my($n, @bases) = @_;
+  return 0 if int($n) < 0;
+  _validate_positive_integer($n);
 
   return 0+($n >= 2) if $n < 4;
   return 0 if ($n % 2) == 0;

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