mpn_gcd documentation

Marco Bodrato bodrato at mail.dm.unipi.it
Mon Aug 19 21:46:43 UTC 2019


Ciao,

Il Dom, 18 Agosto 2019 3:04 pm, Niels Möller ha scritto:
> "Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
>> I glanced at mpn/generic/gcd.c

>> A comment inside slightly relaxes the conditions with:
>>   /* Due to the calling convention for mpn_gcd, at most one can be
>>      even. */

>> ...but I can not find any documented restriction (odd/even) in the
>> manual.

> To me it looks like the code path mpn_gcd -> gcd_22/gcd_2 will fail if
> both inputs to mpn_gcd are even, also before recent changes. And we have

Yes, it's not a matter of recent changes, of course. My fault replying to
one message about them, it's an apart issue.

For sure the assert will fail:
  ASSERT (up[0] & 1);

> no separate unittests; the gcd tests call mpz_gcd, which takes out
> factors of two before calling mpn_gcd.

Writing a separate test would be a good idea. But before writing it, we
need to decide which kind of operands must be tested :-)

Ĝis,
m

-- 
http://bodrato.it/papers(



More information about the gmp-devel mailing list