5

I'm using long double in a C program to compute 2D images of the Mandelbrot Set but wish to have further precision to zoom deeper.

Are there any performance gains to be had from an arbitrary precision maths library that can restrict the amount of precision as required, rather than leaping from long double precision straight into arbitrary precision?

Which is the fastest of the arbitrary precision maths libraries?

James Morris
  • 4,867
  • 3
  • 32
  • 51
  • Here's the result if anyone's interested: http://jwm-art.net/mdz/ – James Morris Jan 03 '10 at 02:16
  • if you don't need arbitrary precision then [`boost::multiprecision`](http://www.boost.org/doc/libs/1_53_0/libs/multiprecision/doc/html/boost_multiprecision/intro.html), with precision "may be arbitrarily large (limited only by available memory), fixed at compile time (for example 50 or 100 decimal digits), or a variable controlled at run-time by member functions", may be better than GMP. Or you can use [`ttmath`](http://www.ttmath.org/) as mentioned [here](http://stackoverflow.com/questions/3692602/fastest-128-bit-integer-library?rq=1) – phuclv Jan 29 '15 at 03:51

2 Answers2

6

'fastest' is going to be somewhat dependent on your platform and intended use.

The MPFR Library

GMP

This wiki article contains links to several libraries.

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
  • +1; mpfr is the gold standard. – Stephen Canon Dec 30 '09 at 22:33
  • I've been using MPFR since your answer. To use, it is much like how I remember MAPM to be, which I used a few years ago on a much older computer. Back then, MAPM on old 32bit hardware was unusable for generating Mandelbrot images even without zooming in at all. Now, on much faster 64bit hardware, MPFR is definitely usable. Poor comparison I know... ... ... ... – James Morris Dec 31 '09 at 03:26
2

If you need more precision, see qd at http://crd.lbl.gov/~dhbailey/mpdist/.

lhf
  • 70,581
  • 9
  • 108
  • 149