gmp_printf bug?

Torbjorn Granlund tg at
Thu Aug 4 22:00:05 CEST 2011

nisse at (Niels Möller) writes:

  > Given the limited use of the code, I was thinking of computing with many
  > extra bits, simply checking that no final value is close to a tie case,
  > and abort if that happens.
  Sounds reasonable to me, but it would be nice to define rigorously what
  thresholds should be used to define the "tie cases".
Well, perhaps so.

Since this will get so limited use, I'll be lazy and simply use very
conservative margins.

  > The code should also generate floor(B*log(b)/log(2)).  Then we can get
  > rid of all floating point arithmetic in GMP, including very slow
  > floating point divides.
  Could be done essentially with the same algorithm, but tabulating the
  roots two; there's no need to recompute them for each base. Right?
Not sure what you mean here.  Surely, one could compute the 2nd, 4th,
8th, ..., 2^255th roots of the prime factors of all bases, and combine
them.  That would be complex, and not worth the debugging effort.

  And then it should also be reasonbly wasy to go from one table to the
  other (just have to think a little bit about rounding directions), so
  this may be a faster way to compute the log(2)/log(b) table as well.
Given n-bit fixed-point approximation log(2)/log(b) (which is what we
currently compute) there is a simple way to compute log(b)/log(2): Plain
old inversion.


More information about the gmp-devel mailing list