diff options
Diffstat (limited to 'src/serial-fractals.c')
| -rw-r--r-- | src/serial-fractals.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/serial-fractals.c b/src/serial-fractals.c index fe420d6..5831f92 100644 --- a/src/serial-fractals.c +++ b/src/serial-fractals.c @@ -1,4 +1,5 @@ #include "fractals.h" +#include "precision.h" #include "grids.h" /* @@ -6,11 +7,11 @@ * if the return value is equal to max_iterations, the point lies within the mandelbrot set * This is an implementation the escape algorithm */ -size_t mandelbrot(const long double complex z0, const size_t max_iterations) { - long double complex z = z0; +size_t mandelbrot(const CBASE complex z0, const size_t max_iterations) { + CBASE complex z = z0; size_t iteration = 0; - while (cabsl(z) <= 2 && iteration < max_iterations) { + while (CABS(z) <= 2 && iteration < max_iterations) { z = z * z + z0; iteration++; } @@ -34,11 +35,11 @@ void mandelbrot_grid(grid_t* grid, const size_t max_iterations){ * if the return value is equal to max_iterations, the point lies within the multibrot set * This is implementation closely matches mandelbrot, but uses cpow which might degrade performance. */ -size_t multibrot(const long double complex z0, const size_t max_iterations, const double d){ - long double complex z = z0; +size_t multibrot(const CBASE complex z0, const size_t max_iterations, const double d){ + CBASE complex z = z0; size_t iteration = 0; - while(cabsl(z) <= 2 && iteration < max_iterations){ - z = cpowl(z, d) + z0; + while(CABS(z) <= 2 && iteration < max_iterations){ + z = cpow(z, d) + z0; iteration++; } return iteration; @@ -62,18 +63,18 @@ void multibrot_grid(grid_t* grid, const size_t max_iterations, const double d){ * * This behaves weirdly, needs a very small number of iterations to be visibile */ -size_t julia(const long double complex z0, const long double complex c, const size_t max_iterations, const double R){ - long double complex z = z0; +size_t julia(const CBASE complex z0, const CBASE complex c, const size_t max_iterations, const double R){ + double complex z = z0; size_t iteration = 0; - while(cabsl(z) < R && iteration < max_iterations){ + while(CABS(z) < R && iteration < max_iterations){ z = z * z + c; iteration++; } return iteration; } -void julia_grid(grid_t* grid, const size_t max_iterations, const long double complex c, const double R){ +void julia_grid(grid_t* grid, const size_t max_iterations, const CBASE complex c, const double R){ const size_t size = grid->size; size_t* data = grid->data; for(size_t i = 0; i <size; i++){ |
