udiv_qr_3by2 vs divappr

Torbjörn Granlund tg at gmplib.org
Mon May 7 15:26:32 UTC 2018

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

  I'm attaching my notes, and below is a version of sbpi1_div_qr.c which
  seems to pass tests (have had t-div running with random seeds for a few
  hours, in a 32-bit build).

  Still unclear (i) if it's correct for d0 = 0, and (ii) exactly what
  conditions we need to exclude divappr2 from return a q that spills over
  from B-1 to 0 the limit in the code, {n1, n0} >= {dn-1, d0} was a guess
  but it might be correct.

I took a quick look at the code.

It is very neat.  Perhaps remove the dn and dn offset-by-2?

And moving the np decrement earlier would change np[-1] to np[0], a very
slight improvement.

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list