JavaScript的:计算一个数字的n次方根方根、数字、JavaScript

2023-09-11 03:25:01 作者:╰ 沐子

我试图让一些使用JavaScript的n次方根,但我不明白的方式使用内置的数学对象来做到这一点。我俯瞰什么? 如果不是...

I'm trying to get the nth root of a number using JavaScript, but I don't see a way to do it using the built in Math object. Am I overlooking something? If not...

有一个数学函数库,我可以使用具有这种功能? 如果不是...

Is there a math library I can use that has this functionality? If not...

什么是最好的算法来做到这一点我自己?

What's the best algorithm to do this myself?

推荐答案

您可以使用这样的事情?

Can you use something like this?

Math.pow(n, 1/root);

如:

Math.pow(25, 1/2) == 5
 
精彩推荐
图片推荐