format compact, format short e

r=sqrt(2.0);
x=1.0;
k=0;
e=abs(r-x);
[k,e]
while(k<10)
  eold=e;
  x=0.5*x+1.0/x;
  e=abs(r-x);
  k=k+1;
  [k,e,e/(eold*eold)]
end