Java中的pow(x,y) [英] pow (x,y) in Java
本文介绍了Java中的pow(x,y)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么区别:
Math.pow ( x,y ); // x^y
收件人:
x^y; // x^y
?
我是否更愿意使用 x ^ y
与 double
类型数字?或shell我必须始终使用 Math.pow()
方法?
Will I prefer to use x^y
with double
type numbers? Or shell I have to use always with Math.pow()
method?
推荐答案
^
是按位排他或(XOR)运算符。它不用于取幂。为此,您必须使用 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文