Speed of GMP relative to MPFR for quad precision calculations

Zimmermann Paul Paul.Zimmermann at loria.fr
Fri Nov 2 09:01:29 CET 2012


       Jerry,

> From: Jerry <lanceboyle at qwest.net>
> Date: Thu, 1 Nov 2012 16:30:35 -0700
> 
> Hi,
> 
> I recently started using MPFR in an application where I am certain that quad precision would be adequate. I have been using MPFR with 30 digits precision. But I just now learned that MPFR provides _exactly_ the specified precision and that GMP uses whatever number of machine words is necessary to meet the specified precision. That makes me think that MPFR is slower than GMP floats.
> 
> Indeed, MPFR is running more slowly than I hoped. Would GMP's floating point facility run faster in this application (quad precision) than MPFR? I need only multiplies and adds, and conversion back to double precision at the end.
> 
> Thanks,
> Jerry

maybe GMP mpf will run slightly faster, but timings should be very close, since
both rely on GMP mpn layer. See http://www.mpfr.org/mpfr-3.1.0/timings.html
for some timings for larger precisions.

Paul Zimmermann


More information about the gmp-discuss mailing list