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

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

commit 8e2236731c187ca78272f635217fe95f3eb2af10
Author: Dana Jacobsen <d...@acm.org>
Date:   Sat Jun 30 15:23:31 2012 -0600

    Do a mod before power operations -- avoids fp exception for very large 
bases on small n
---
 factor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/factor.c b/factor.c
index 4f49763..ce55363 100644
--- a/factor.c
+++ b/factor.c
@@ -141,6 +141,7 @@ int trial_factor(UV n, UV *factors, UV maxtrial)
 #ifndef HALF_WORD
   static UV powmod(UV n, UV power, UV m) {
     UV t = 1;
+    n %= m;
     while (power) {
       if (power & 1)
         t = mulmod(t, n, m);
@@ -152,8 +153,8 @@ int trial_factor(UV n, UV *factors, UV maxtrial)
 #else
   static UV powmod(UV n, UV power, UV m) {
     UV t = 1;
+    n %= m;
     if (m < HALF_WORD) {
-      n %= m;
       while (power) {
         if (power & 1)
           t = (t*n)%m;

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