From b12b4ff429a8a6394163509682251caf6815c669 Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 12 May 2013 11:15:15 +0200 Subject: [PATCH] better comments --- mandelbrot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;