Help stabilising mini-gmp

Torbjörn Granlund tg at gmplib.org
Wed Nov 16 20:16:24 UTC 2016


nisse at lysator.liu.se (Niels Möller) writes:

  I've tracked this one down to incorrect results from mpn_invert_3by2.
  I'll investigate, and in the process try to document how it works, and
  maybe rewrite it (it's a bit too hairy for its own good).
  
I am very worried about this, as well as past and lingering arithmetic
bugs in mini-gmp.  Important lessons need to be learned, and full
disclosure to our user needs to be made.

I have not looked at the mini-gmp sources, except very briefly.  I
understood the project as a plain, safe implementation of core functions
of GMP.  Now, looking back, we know that the initial implementation was
very buggy, and clearly the code is still not great.  I am very far from
convinced that fixing the new miscalculation bugs will result in stable
implementation.

If we still believe in the idea of mini-gmp as part of a known robust
library as GMP, I suggest that we do the following: Do not write any new
code such as mpn_invert_3by2.  Only grab code from GMP, extracting the
most fundamental algorithms.  Sometimes this will require editing to
simplify the code; this work needs to be done carefully and
thoughtfully.  Perhaps this is boring, but I am sure that our users
prefer the boring property of correct computation results over never so
surprising miscalculations!

Under no circumstances should mini-gmp be a platform for trying out
cool, new algorithms.

  It could also use some units test of its own; result is easy to
  validate.
  
Perhaps better tests are needed.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list