I'm having trouble calculating the Nth root of a given value. I don't understand what's going wrong in the algorithm, but the values are incredibly close. Only off by about 0.78891 for small values, and about 0.52 for larger ones. So any help with this is appreciated; I don't want to use Math.Pow for this.
public static float NthRoot(int Root, int Value) {
if (Value == 0) { return 0; }
double Δ = (Value / Root) + 1;
double Ω = (Δ + (Value / Root)) / Root;
while (Ω < Δ) {
Δ = Ω;
Ω = (Δ + (Value / Δ)) / Root;
}
return (float)Δ;
}
Thanks