gcd_22

Niels Möller nisse at lysator.liu.se
Mon Aug 26 04:37:53 UTC 2019


Victor Shoup <shoup at cs.nyu.edu> writes:

> Regarding the so-called doc bug, if I understand the issue correctly,
> I don’t think it’s a good idea to add more preconditions to the
> documentation. In fact, I think that would be a really bad idea.

I agree it's usually a bad idea, but may be ok under the circumstances.
What's happened:

1. There used to be rather specific input requirements on mpn_gcd
   inputs.

2. Implementation was rewritten, making most of those requirements
   irrelevant.

3. Documentation was updated to relax requirements. Unfortunately,
   documentation was relaxed a bit too far, since the implementation
   never worked for both inputs being even. (commit
   https://gmplib.org/repo/gmp/rev/71efb0367192, 2011).

   It would crash with an assert in gcd_22, if asserts are enabled. I'm
   not sure in which way it would fail if asserts are disabled, but I
   think it would both produce a wrong result and do that very slowly.

4. There's been no bug reports since, about mpn_gcd not working properly
   for two even inputs.
 
Regards,
/Niels

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


More information about the gmp-devel mailing list