/* square root and absolute value functions */
#include <assert.h>

double sqrt(double r) 
/* function to compute square root of r */
{ double change = 1.0;    /* square roots are found using Newton's method */
  double x = r;
  if (r == 0.0)
     return 0.0;         /* the square root of 0.0 is a special case */
  assert (r > 0.0);      /* negative square roots are not defined */
  while ((change > 0.00005) || (change < -0.0005))
    { change = (x*x - r) / (2*x);
      x -= change;
    }
  return x;
}

double fabs (double x)
/* function to compute absolute values */
{  if (x < 0)
       return (-x);
   else return (x);
}


