Search code examples
c++doubleprecisiondigitmandelbrot

c++ double more accuracy/precision


Is there any floating point type that stores more digits after the decimal point than double in c++ (or any alternative, which makes double stored more digits)?

I've read that long double is maybe more accurate.

In my program we can zoom into the Mandelbrot set, but after some zoom the picture gets pixelated. I think it is because the length between two complex numbers associated with two neighboring pixels is less than the difference between two consecutive value of double. In the program I used long double.

If it's important, then the processor of my computer is Intel® Core™ i3 CPU M 380 @ 2.53GHz × 4, the computer is 64 bit, the operating system is Ubuntu and the compiler is gcc.

the pixelated Mandelbrot set


Solution

  • You should take a look at third party libraries like boost.multiprecision or even GMP.

    You can also do it "by hand" but that would be a lot of work. You would have to keep numbers as their string representation and manually make the arithmetic operations yourself.