N = 2;
t = 1e-12;
x = N;
p = 1;

while abs(x-p)/N > t
   p = x;
   x = (p + N/p) / 2;
end;

[x, (x-sqrt(N))*1e16]
