#include <stdio.h>
#include "sqrt.h"

static const double epsilon = 0.001;

double sqrt(double x)
{
  double low  = 0.0;
  double high = x;
  double root;

  while (high - low > epsilon) {
    root = (high + low) / 2.0;
    if (root * root > x)
      high = root;
    else
      low  = root;
    printf("%E %E %E\n", high, low, root);
  }
  return root;
}
