let sqrt_newton x = let g = ref 1.0 in for _ = 1 to 20 do g := (!g +. x /. !g) /. 2.0 done; !g ;; int_of_float (sqrt_newton 2.0 *. 1000.0)