expected behaviour of mpn_extgcd

Bill Allombert Bill.Allombert at math.u-bordeaux1.fr
Thu Oct 8 23:46:29 CEST 2009

Dear GMP developers,

GMP function mpn_gcdext(a,b) used to return the smallest u in absolute value
such that a*u+b*v=d. This is no more the case in version 4.3, for example for 
we expect u=1,v=0 since a divides b, but we get u=-7392011, v=0.
and unfortunately this change breaks PARI/GP.

Is this change intentional ? In that case, could the documentation clarify
what values for u are acceptable ? (The documentation terms "u" '_The_ first
cofactor' (emphasis mine) which somehow induce a French reader to expect it to
be uniquely defined. We are taught that way...).

Thanks for your answer,
PARI/GP developer

More information about the gmp-bugs mailing list