[Solved] How to calculate nth roots without math.h


You can reformulate the question y = sqrt(x) as to find the value for y such that y*y - x equals zero. The easiest way to solve that equation is by doing a bisection on y (http://en.wikipedia.org/wiki/Bisection_method) between 0 and x (because 0 <= sqrt(x) <= x for all real numbers x where x should satisfy x >= 0).

Alternatively you can resort to Newton’s method, although that is slightly more advanced and is not guaranteed to converge (while bisection is, if the correct answer lies within the initial interval).

solved How to calculate nth roots without math.h