diff --git a/mandelbrot.c b/mandelbrot.c index f13bae3..46b4725 100644 --- a/mandelbrot.c +++ b/mandelbrot.c @@ -28,8 +28,12 @@ void drawmandelbrot(SDL_Surface *surface) { bool diverges = false; float complex z = 0; int it; - for (it = 1; it < 256; it++) { + const int max_it = 170; + for (it = 1; it <= max_it; it++) { + /* z = z² + c */ z = cpowf(z, 2) + c; + + /* If |z| ever gets greater than 2, it diverges. */ if (cabs(z) > 2) { diverges = true; break;