如何在不使用函数的情况下根据数字计算任何给定幂的根Math::pow?
void res() {
int root = 2, numb = 16;
num res = pow(numb, 1 / root);
print(res); //Output: 4.0
}
也许有其他PL的解决方案,我也会熟悉答案。
如何在不使用函数的情况下根据数字计算任何给定幂的根Math::pow?
void res() {
int root = 2, numb = 16;
num res = pow(numb, 1 / root);
print(res); //Output: 4.0
}
也许有其他PL的解决方案,我也会熟悉答案。
答案就在这篇文章Algorithm for calculating the root of n-th degree from an arbitrary positive number
一切。