ref: 1c52c3c30241558dcc6bf01a618528cfe8f552b2
dir: /test/sqrt.myr/
use std const abs = {d if d < 0.0 -> -d else -> d ;; } const Eps = 0.00001 const Maxiter = 20 const sqrt = {x : float64 var val var iter var i; val = 1.0; for i = 0; i < Maxiter; i++ iter = 0.5*(val - x/val) if abs(val - iter) < Eps -> val; val = iter; ;; ;; } const main = { std.exit(sqrt(20.0) castto(int)) }