set numerical tolerance as 1e-8