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

2nd Mar 2022, 3:44 PM
Black Chicken
Black Chicken - avatar
7 odpowiedzi
0
For any root
2nd Mar 2022, 3:58 PM
Black Chicken
Black Chicken - avatar
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.
2nd Mar 2022, 4:02 PM
Black Chicken
Black Chicken - avatar
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 }
2nd Mar 2022, 4:09 PM
Mustafa A
Mustafa A - avatar
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.
2nd Mar 2022, 4:14 PM
Mustafa A
Mustafa A - avatar
0
Thank you mustafa A you are a real hacker man,also 5 bucks says you’re from turky.
2nd Mar 2022, 4:15 PM
Black Chicken
Black Chicken - avatar
0
Would it work?
2nd Mar 2022, 4:45 PM
Black Chicken
Black Chicken - avatar
0
Also im trying to do it manuly to increase my knowledge on c++
2nd Mar 2022, 4:47 PM
Black Chicken
Black Chicken - avatar