mpn_bdiv_q

Torbjorn Granlund tg at gmplib.org
Mon Dec 7 18:26:31 CET 2009


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

  If I remember the design from earlier discussions, the function bdiv_q
  is supposed to take as inputs N of size nn, odd D of size dn <= nn, and
  compute N*D^{-1} mod B^nn. The size of the quotient is thus qn == nn.
  {sbpi1,dcpi1,mu}_bdiv_q.c seem to do that.
  
Yes, the function mpn_bdiv_q seems to define things differently.  The
functions mpn_sbpi1_bdiv_q and mpn_dcpi1_bdiv_q work as you say.

I don't know why mpn_bdiv_q work like it does.  We should probably
change its interface.

  But the top level function mpn_bdiv_q sets qn = nn - dn + 1, so it
  doesn't fit. Test cases also lacking... I'm fairly sure we used to have
  test code when developing the various bdiv functions.
  
For those with access to shell.gmplib.org there is test code in
~tege/test-bdivisions.c (and test-divisions.c for plain division).

-- 
Torbjörn


More information about the gmp-devel mailing list