Ciao,
Il 2022-09-05 21:23 ni...@lysator.liu.se ha scritto:
Marco Bodrato writes:
I propose to also add a couple of tests to mini-gmp/tests/t-powm.c ,
to keep track of this.
Definitely needed, thanks for looking into that.
+ if (mpz_cmp_ui (res, 1) <= 0)
+mpz_add_ui (res, res, 9);
Ad
Marco Bodrato writes:
>>> or even (mn == 0 check just above this code rules out |m| < 1)
>>>
>>>mpz_set_ui (r, mpz_cmpabs_ui (m, 1));
>
> I agree with this solution. Will you commit it?
Committed, and I've verified that it fixes Guido's test case.
> I propose to also add a couple of tests
Ciao,
Il 2022-08-30 10:25 Vincent Lefevre ha scritto:
or even (mn == 0 check just above this code rules out |m| < 1)
mpz_set_ui (r, mpz_cmpabs_ui (m, 1));
I agree with this solution. Will you commit it?
Concerning this second solution, the GMP manual says:
-- Function: int mpz_cmpabs_u
Il 2022-09-05 19:04 Marco Bodrato ha scritto:
Il 2022-08-30 10:25 Vincent Lefevre ha scritto:
or even (mn == 0 check just above this code rules out |m| < 1)
mpz_set_ui (r, mpz_cmpabs_ui (m, 1));
I agree with this solution. Will you commit it?
I incorrectly removed the "Niels Möller wrote
On 2022-08-30 08:45:34 +0200, Niels Möller wrote:
> Paul Zimmermann writes:
>
> > $ diff -u mini-gmp.c.orig mini-gmp.c
> > --- mini-gmp.c.orig 2022-08-29 10:28:20.700995412 +0200
> > +++ mini-gmp.c 2022-08-29 10:27:36.112191428 +0200
> > @@ -3060,6 +3060,7 @@
> >if (en == 0)
> > {
>
Paul Zimmermann writes:
> $ diff -u mini-gmp.c.orig mini-gmp.c
> --- mini-gmp.c.orig 2022-08-29 10:28:20.700995412 +0200
> +++ mini-gmp.c 2022-08-29 10:27:36.112191428 +0200
> @@ -3060,6 +3060,7 @@
>if (en == 0)
> {
>mpz_set_ui (r, 1);
> + mpz_tdiv_r (r, r, m);
>
Thank you, I have confirmed that your patch resolves the issue.
On Mon, Aug 29, 2022 at 10:29 AM Paul Zimmermann
wrote:
> thank you, I confirm the bug, here is a potential fix:
>
> $ diff -u mini-gmp.c.orig mini-gmp.c
> --- mini-gmp.c.orig 2022-08-29 10:28:20.700995412 +0200
> +++ mini-gmp.c
thank you, I confirm the bug, here is a potential fix:
$ diff -u mini-gmp.c.orig mini-gmp.c
--- mini-gmp.c.orig 2022-08-29 10:28:20.700995412 +0200
+++ mini-gmp.c 2022-08-29 10:27:36.112191428 +0200
@@ -3060,6 +3060,7 @@
if (en == 0)
{
mpz_set_ui (r, 1);
+ mpz_tdiv_r (r, r
The following program computes 1^0 % 1:
//#include
#include "mini-gmp.c"
#include
#define CF_CHECK_EQ(expr, res) if ( (expr) != (res) ) { goto end; }
int main(void)
{
mpz_t a, b, c, res;
char* s = NULL;
/* noret */ mpz_init(a);
/* noret */ mpz_init(b);
/* noret */ mpz_init(