Task

Implement the algorithm to compute the principal   nth   root   





A

n





{\displaystyle {\sqrt[{n}]{A}}}

   of a positive real number   A,   as explained at the   Wikipedia page.



nthRoot: function [a,n][
    N: to :floating n
    result: a
    x: a / N
    while [0.000000000000001 < abs result-x][
        x: result
        result: (1//n) * add (n-1)*x a/pow x n-1
    ]
    return result
]
 
print nthRoot 34.0 5
print nthRoot 42.0 10
print nthRoot 5.0 2