[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gmp-bugs
Subject:    mpz_divexact bug for PPC64
From:       nisse () lysator ! liu ! se (Niels =?utf-8?Q?M=C3=B6ller?=)
Date:       2015-10-03 8:40:56
Message-ID: nnoaggjqef.fsf () armitage ! lysator ! liu ! se
[Download RAW message or body]

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.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic