New or modified function

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Thu Nov 19 13:06:23 CET 2009


Ciao,

>> exmul(a,b)=(a/g)*(b/g).
>> 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

And I'd expect it to be faster also when g is small, because you trade two
division which results have sizes (as) and (bs), with one which result
have size (as+bs) approximately... and the cost is not sub-linear on that
size.

But...

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

I agree with Niels, and I guess (a*b)/(g^2) can win for 1-2 limbs operands.

Regards,
Marco

-- 
http://bodrato.it/



More information about the gmp-devel mailing list