*FLOAT 64 @% = &D0D PRINT "Cube root of 5 is "; FNroot(3, 5, 0) PRINT "125th root of 5643 is "; FNroot(125, 5643, 0) END DEF FNroot(n%, a, d) LOCAL x0, x1 : x0 = a / n% : REM Initial guess REPEAT x1 = ((n% - 1)*x0 + a/x0^(n%-1)) / n% SWAP x0, x1 UNTIL ABS (x0 - x1) <= d = x0