home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_12 / smith1.lis < prev    next >
File List  |  1991-09-26  |  346b  |  14 lines

  1.  
  2. #include <math.h>
  3. #define ABSOLUTE_EPSILON      1e-10
  4. #define RELATIVE_EPSILON      1e-6   /* 6 digits */
  5. float xnew, xold;
  6.  
  7. xnew = 1.0;  /* some initial estimate */
  8. do { 
  9.   xold = xnew;
  10.   xnew = solution_refinement (xold);
  11. } while ( fabs(xnew - xold) > ABSOLUTE_EPSILON &&
  12.      fabs (xnew-xold) > fabs(xnew) * RELATIVE_EPSILON );
  13.  
  14.