mpn_gcd[ext] interface details (was: Re: Cofactor canonicalisation of mpn_gcdext)

Niels Möller nisse at
Tue May 10 16:39:01 CEST 2011

nisse at (Niels Möller) writes:

> I've tried to clarify the mpz_gcdext documentation now. Feel free to
> double check that the conditions on S and T make sense (including the
> borderline cases where one or both inputs are zero). I also edited the
> description of mpz_gcd, to document that we define gcd(0,0) = 0.

And what about normalization of the inputs? The mpn_gcdext documentation
says nothing about normalization. The documentation for mpn_gcd says
that both inputs must be normalized.

I think the actual requirements for both functions are something like

  * an < bn is not allowed

  * if an == bn, then at least one of a or b must be normalized.

  * if an > bn, then b must be normalized

In particular, a > b seems not to be necessary in all cases.

What should the documented requirements be?


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