[Gmp-commit] /var/hg/gmp: mini-gmp/mini-gmp.c (mpz_powm): Fix case of x^0 (mo...

mercurial at gmplib.org mercurial at gmplib.org
Mon Sep 5 21:06:16 CEST 2022


details:   /var/hg/gmp/rev/137fe73908e1
changeset: 18368:137fe73908e1
user:      Niels Möller <nisse at lysator.liu.se>
date:      Mon Sep 05 21:05:59 2022 +0200
description:
mini-gmp/mini-gmp.c (mpz_powm): Fix case of x^0 (mod 1), should be 0.

Reported by Guido Vranken.

diffstat:

 mini-gmp/ChangeLog  |  5 +++++
 mini-gmp/mini-gmp.c |  2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r b0d6b9f5807e -r 137fe73908e1 mini-gmp/ChangeLog
--- a/mini-gmp/ChangeLog	Sat Aug 20 18:44:17 2022 +0200
+++ b/mini-gmp/ChangeLog	Mon Sep 05 21:05:59 2022 +0200
@@ -1,3 +1,8 @@
+2022-09-05  Niels Möller  <nisse at lysator.liu.se>
+
+	* mini-gmp.c (mpz_powm): Fix case of x^0 (mod 1), should be 0.
+	Reported by Guido Vranken.
+
 2022-05-29 Marco Bodrato <bodrato at mail.dm.unipi.it>
 	* mini-mpq.c (mpq_helper_2exp): New helper (internal) function.
 
diff -r b0d6b9f5807e -r 137fe73908e1 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Sat Aug 20 18:44:17 2022 +0200
+++ b/mini-gmp/mini-gmp.c	Mon Sep 05 21:05:59 2022 +0200
@@ -3098,7 +3098,7 @@
 
   if (en == 0)
     {
-      mpz_set_ui (r, 1);
+      mpz_set_ui (r, mpz_cmpabs_ui (m, 1));
       return;
     }
 


More information about the gmp-commit mailing list