mpz_divexact bug for PPC64

Marc Glisse marc.glisse at
Sat Oct 3 07:31:35 UTC 2015

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

I guess that's part of the contract. The functions are fast, but you must 
satisfy the precondition or you cannot use them at all. I wouldn't be 
surprised if x86 vs x86_64 already gave different results.

If you configure GMP with --enable-assert, it will abort instead.

(I didn't look at the code to check why it returns this strange result, I 
am not familiar with that code)

Marc Glisse

More information about the gmp-bugs mailing list