prec 1e-12 and max iter 1000