slowness

Alban Nonymous alban.nonymous at gmail.com
Tue Jan 22 15:28:17 CET 2008


I am a little surprised you get a ~200-fold slowdown.

Are you using GMP's floats because of the accuracy or because of the
range (of the exponent)?  What precision of the GMP floats are you
requesting?

If it is only range you're after, perhaps maintaining a seprate
overflow exponent for each "double" would be an alternative.  After an
arithmetic operation, you need to check if the exponent is > 100 (say)
or less than -100.  Then you canonicalize it, and add (subtract) 100  to
your overflow exponent.

(To make this fast, don't use ldexp and its related functions, instead
just do C comparisions "if (x > 1e100) {x *= 1e-100; xexp += 100;})

Alban


More information about the gmp-discuss mailing list