mpz_divexact bug for PPC64
Niels Möller
nisse at lysator.liu.se
Sat Oct 3 08:40:56 UTC 2015
Marc Glisse <marc.glisse at inria.fr> writes:
> On Mon, 21 Sep 2015, Leonardo Bianconi wrote:
>
>> Description: mpz_divexact has not the same result for PPC64,
>> comparing with x86, when division is not exact.
>
> "These functions produce correct results only when it is known in
> advance that d divides n."
Right, the implementation is allowed to do anything it likes when the
division isn't exact. Current implementation might call divrem_1 (plain
euclidean division, depending on platform-specific tuning) for small
divisors, otherwise it divides out powers of two, followed by a
division mod B^n. So it's not surprising if the result depends on the
word size.
And when we switch to using Jebeleans algorithm, the result in the case
of a non-exact division will get bogus in a completely different way.
So don't do that.
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-bugs
mailing list