本文介绍了立方根的负数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试找到负数的立方根,但我得到了一个NaN。有什么帮助吗?
I'm trying to find the cube root of a negative number but I get a NaN. Any help?
System.out.println(Math.pow(-8, 1.0 / 3.0));
推荐答案
Math的Java文档.pow
状态:
您可以使用 Math.cbrt
获取多维数据集根目录:
You could use Math.cbrt
to get the cube root:
double result = Math.cbrt(-8.0);
这篇关于立方根的负数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!