
#include <math.h>
#define ABSOLUTE_EPSILON      1e-10
#define RELATIVE_EPSILON      1e-6   /* 6 digits */
float xnew, xold;

xnew = 1.0;  /* some initial estimate */
do { 
  xold = xnew;
  xnew = solution_refinement (xold);
} while ( fabs(xnew - xold) > ABSOLUTE_EPSILON &&
     fabs (xnew-xold) > fabs(xnew) * RELATIVE_EPSILON );

