[MPFR] multiplications vs. subtractions: which one is faster?

Vincent Lefevre vincent at vinc17.org
Wed Jul 18 00:15:32 CEST 2007

On 2007-07-15 10:54:03 +0200, Paul Zimmermann wrote:
> Thank you Patrick. However I'd like to point out that those figures
> (I mean the ratio of the number of cycles for both variants) might
> vary from one platform to the other, maybe by more than a factor of
> two. They might also depend on the version of mpfr, on the fact that
> GMP and/or MPFR were tuned for that platform, and on the actual
> operand values

Yes, that's why it is better to implement both solutions and compare

> (in particular mpfr_sub might be slower when subtracting numbers
> that are very close).

Perhaps not. AFAIK, the number of canceled bits (computed early in
the mpfr_sub1 function) is taken into account to avoid unnecessary

Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)

More information about the gmp-discuss mailing list