Fractal Speedup Question

Jim White mathimagics at
Thu Jan 19 15:32:39 CET 2006

Jorgen Hochwald  writes:

> The thoughts are to have some kind of fixpoint
numbers with 
> (for example) eight bit before the point and the
rest after 
> the point. 
> Now all normalisation-steps (required for the
floating point
> numbers) are not needed.
> Question: can this speed up the calculations and how
can I use
> fixpoint numbers with GMP ?

I can't see any advantage in adopting a "fixed-point"
approach  here all.  To begin with, there is no
significant overhead attached to "normalisation" in a
floating-point multiplication, which is effectively
just an integer multiplication plus an addition of

To emulate that using integers you would have to
re-invent the mpf method of automatic precision
limitation, since integer multiplications (with mpz)
is done with dynamically extended precision.  

With a typical Mandelbrot-set iteration, you are
repeatedly squaring, so you would have to continually
do manual result truncation to prevent the values
growing exponentially in size.

The mpf data type maintains a fixed maximum precision
by design, and a multiplication only returns as many
significant digits as you ask for. 

In fact, even if you did decide to implement a
fixed-point emulation, you will probably find mpf is a
better medium than mpz because its multiplication is
already optimised to produce a restricted precision

Regarding the basic Mandelbrot iteration, there is not
really much you can do to optimise it.

There are ways to test x^2 + y^2 < N (inside/outside
test) without doing the squarings in many cases - but
this is of no benefit for the Mandelbrot iteration as
you need these values for the next iteration anyway.

Jim White

More information about the gmp-discuss mailing list