class MATH is nthroot(n:INT, a:FLT):FLT pre n > 0 is x0 ::= a / n.flt; m ::= n - 1; loop x1 ::= (m.flt * x0 + a/(x0^(m.flt))) / n.flt; if (x1 - x0).abs < (x0 * 1.0e-9).abs then return x1; end; x0 := x1; end; end; end;