All pastes #241415 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-11-06 04:23 UTC
rendered paste body
double mandelbrot(int x, int y)
{
  /* The point value is the numbre of iterations it takes for
   * the algorithm to meet the escape condition
   */
  int x0 = x, y0 = y, x2 = x*x, y2 = y*y;
  int itr = 0, most = 500;

  while(x2+y2 < 4 and itr < most)
    {
      y = 2 * x * y + y0;
      x = x2 - y2 + x0;

      x2 = x*x;
      y2 = y*y;

      itr++;
    }

  /* I want values between 0 and 500*/
  return itr;
}