New or modified function

Niels Möller nisse at lysator.liu.se
Thu Nov 19 11:34:41 CET 2009


Wojciech Florek <Wojciech.Florek at amu.edu.pl> writes:

> exmul(a,b)=(a/g)*(b/g).

I think it would be simplest to implement this on top of the mpz
interface, not messing with internals and things like TMP_DECL.

> BTW, I wonder if exmul=(a*b)/(g^2) is faster (2 divexact and 1 mul
> versus 1 mul, 1 square and 1 divexact, but for larger numbers).

I'd expect (a/g) * (b/g) to be a lot faster when g is large (since the
running time for both the divisions and the product essentially depend
on the size of the quotients, which are small when g is large), while
(a*b)/g^2 may be sligtly faster when g is small (since in this case
the quotients are large, and the cost of each division will be more
significant).

But real benchmarking is the only way to find out for sure...

Regards,
/Niels


More information about the gmp-devel mailing list