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 bbcbdb67b375f9d3e76bb78a93f75e8b73841d53
Author: Dana Jacobsen <d...@acm.org>
Date:   Thu Oct 18 01:01:38 2012 -0600

    Fix up primorial and pn_primorial for bigints
---
 lib/Math/Prime/Util.pm | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 6e85e88..4b5a207 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -653,11 +653,14 @@ sub primes {
 }
 
 sub primorial {
-  my $n = shift;
+  my($n) = @_;
   _validate_positive_integer($n);
 
-  return Math::Prime::Util::GMP::primorial($n)
-         if $_HAVE_GMP && defined &Math::Prime::Util::GMP::primorial;
+  if ($_HAVE_GMP && defined &Math::Prime::Util::GMP::primorial) {
+    return (ref($_[0]) eq 'Math::BigInt')
+        ?  $_[0]->copy->bzero->badd( Math::Prime::Util::GMP::primorial($n) )
+        :  Math::Prime::Util::GMP::primorial($n);
+  }
 
   my $pn = 1;
   $pn = Math::BigInt->new->bone if defined $bigint::VERSION &&
@@ -670,7 +673,13 @@ sub primorial {
 }
 
 sub pn_primorial {
-  return primorial( nth_prime($_[0]) );
+  my($n) = @_;
+  if ($_HAVE_GMP && defined &Math::Prime::Util::GMP::pn_primorial) {
+    return (ref($_[0]) eq 'Math::BigInt')
+        ?  $_[0]->copy->bzero->badd( Math::Prime::Util::GMP::pn_primorial($n) )
+        :  Math::Prime::Util::GMP::pn_primorial($n);
+  }
+  return primorial(nth_prime($n));
 }
 
 

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