Likely GMP bug
bodrato at mail.dm.unipi.it
Sun May 27 13:52:06 UTC 2018
Il Dom, 27 Maggio 2018 12:09 am, Marco Bodrato ha scritto:
> Il Sab, 26 Maggio 2018 11:01 pm, Niels Möller ha scritto:
>> Is it possible to construct some examples with v a multiple of 641, and
>> input U such that ulimb = 2^31 after reduction?
> factor = 641; /* A factor of GMP_NUMB_MAX + 2 */
> vlimb = factor * (GMP_NUMB_MAX / factor - 1);
> ASSERT (vlimb > CNST_LIMB (1) << 31);
> mpz_set_ui (U, vlimb);
> mpz_mul_ui (U, U, somerandomdata);
> mpz_add_ui (U, U, CNST_LIMB (1) << 31);
> /* Try also sub_ui, because of MODEXACT */
Of course I'm wrong :-/
With MODEXACT things are not as easy as I hoped...
My previous test was with V=GMP_NUMB_MAX, in this case with MODEXACT you
can have a factor +/- 1, but in the general case, it's not that easy...
More information about the gmp-bugs