本文介绍了Java 中的 pow (x,y)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么区别:
Math.pow ( x,y ); // x^y
致:
x^y; // x^y
?
我是否更喜欢将 x^y
与 double
类型数字一起使用?还是我必须始终使用 Math.pow()
方法的 shell?
Will I prefer to use x^y
with double
type numbers? Or shell I have to use always with Math.pow()
method?
推荐答案
^
是 按位异或 (XOR) 运算符在Java(和许多其他语言)中.它不用于求幂.为此,您必须使用 Math.pow
.
^
is the bitwise exclusive OR (XOR) operator in Java (and many other languages). It is not used for exponentiation. For that, you must use Math.pow
.
这篇关于Java 中的 pow (x,y)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!