multiplications vs. subtractions: which one is faster?

Michael comtech.usa at
Sun Jul 15 04:36:22 CEST 2007

Hi all,

In my project I am seeking ultimate speed. In one small part of my
program using GMP/MPFR, I am facing the following two design choices:

The operands/variables are of 1000 digits precision in MPFR mpfr_t
format(floating point numbers).

1. Using two for loops with around 80*80=6400 substractions;
2. Using one for loop 7+15+21+32+63=138 additions and 138 multiplications,

Which approach will be faster? Please shed some lights on me from your

Since the change in design is complicated (the MPFR programming is
much like arranging registers in assembly language programming), I
want to first do some thought experimenting and comparison.

Moreover, I would appreciate any further
suggestions/advice/comments/tips on how to improve speed using MPFR

Thanks a lot!

More information about the gmp-discuss mailing list