mandelbrot fractal

Marco Bodrato bodrato at mail.dm.unipi.it
Tue Sep 8 20:46:22 UTC 2015


Ciao,

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,
http://www.mpfr.org/ .

> // released under agpl v3.0

Nice licence :-)

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

Did you read the manual?
https://gmplib.org/manual/Initializing-Floats.html
It seems like you are reimplementing mpf_init2...

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

mpf_mul_2exp?

> 			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

Funny!

Regards,
m

-- 
http://bodrato.it/



More information about the gmp-discuss mailing list