Speed of GMP relative to MPFR for quad precision calculations

Marc Glisse marc.glisse at inria.fr
Sun Nov 18 10:09:24 CET 2012


(redirecting to mpfr)

On Thu, 1 Nov 2012, Jerry wrote:

> 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.

I don't think it has been mentioned in this thread, but if you are happy 
with 1 or 2 digits less, double-double arithmetic could be much faster 
(especially on machines with hardware FMA). At least the conversions from 
and to double take no time at all ;-)

-- 
Marc Glisse


More information about the gmp-discuss mailing list