Torbjorn Granlund <t...@gmplib.org> writes: > The quotient might need one more bit using this alternative convention. > Right? We have no great place to return it.
I'd suggest the convention that Q = -N D^{-1} (mod B^{nn - dn}) R B^{qn} = N + Q D Then Q is qn = nn - dn limbs, no extra bit, and 0 <= R < B^dn + D This is the same as for the current redc functions. But I'm leaning towards putting the returned R at the high end rather than the low, and with the loop organization you suggest it should then work fine to put Q at the low end. Maybe we don't even need bdiv_r then, if bdiv_qr (up, up, un, dp, dn) is cheap enough (storing the q limbs at the low end of U). Ah, and notation. I suggest we write U for the numerator, rather than N, like we have been doing in some other division work. To avoid confusion with n used as a limb count (worse when talking than when writing). Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org http://gmplib.org/mailman/listinfo/gmp-devel