mandelbrot fractal

Marco Bodrato bodrato at
Tue Sep 8 20:46:22 UTC 2015


Il Lun, 7 Settembre 2015 1:58 pm, folkert ha scritto:
> Now what I'm curious about: can this piece of code be improved in some
> way? From a GMP-lib usage point of view I mean.

The standard suggestion for people using mpf is: try MPFR, .

> // released under agpl v3.0

Nice licence :-)

> void my_init_mpf(mpf_t *const what, const int n_bits)

Did you read the manual?
It seems like you are reimplementing mpf_init2...

> 			do {
> 				mpf_mul(t, wy, two);	// y = 2 * y


> 			while(mpf_cmp_d(t, 16.0) < 0 && ++it < max_it);

mpf_cmp_ui is probably simpler, but most of the time is surely spent in
multiplications (squarings!) ...

> Please note that it emits a .pnm-file to stdout. So if you want to run
> it yourself, invoke it like this:
> ./a.out > test.pnm




More information about the gmp-discuss mailing list