0
Hi i was having trouble make a c++ program that finds any root of any numberI know how to do square roots but i want to do for
Any root
7 odpowiedzi
0
For any root
0
So you input two values on would be the number under the root and. The other would be the power of the root,for e.g(2,3) would be the the cubic root of two.
0
Brute force it.
double tolerance = 0.001;
double nthRoot = 0.0;
int order = ; // the order
int num = ; // some number
while (abs(pow(nthRoot, order) - num) / num < tolerance) {
nthRoot += tolerance; // step
}
0
Then dived it into smal ranges and parallelize it. Where one thread calculates nthRoot 0.0 -> 10. And the second one 10 -> 20 and so on.
0
Thank you mustafa A you are a real hacker man,also 5 bucks says you’re from turky.
0
Would it work?
0
Also im trying to do it manuly to increase my knowledge on c++