Cofactor canonicalisation of mpn_gcdext

Niels Möller nisse at
Sat Apr 30 14:08:12 CEST 2011

Marc Glisse <marc.glisse at> writes:

> the documentation of mpn_gcdext looks nice and precise.

Hmm. The doc also says

     The areas {XP, XN+1} and {YP, YN+1} are destroyed (i.e. the input
     operands plus an extra limb past the end of each).

I wonder if it still needs that extra limb. At least mpn_gcd doesn't
need it anymore (and the documentation says so).

> On the other
> hand, the documentation of mpz_gcdext leaves a lot of room for
> different output:
> "The values in s and t are chosen such that abs(s) <= abs(b) and
> abs(t) <= abs(a)."
> Should a tighter bound be documented there too?

I think so. The more strict bounds are enforced in tests/mpz/t-gcd.c.


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list