本文整理汇总了Java中org.apache.commons.math.util.MathUtils.pow方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.pow方法的具体用法?Java MathUtils.pow怎么用?Java MathUtils.pow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.util.MathUtils
的用法示例。
在下文中一共展示了MathUtils.pow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pow
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
* <p>
* Returns a <code>BigFraction</code> whose value is
* <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form.
* </p>
*
* @param exponent
* exponent to which this <code>BigFraction</code> is to be raised.
* @return <tt>this<sup>exponent</sup></tt> as a <code>BigFraction</code>.
*/
public BigFraction pow(final BigInteger exponent) {
if (exponent.compareTo(BigInteger.ZERO) < 0) {
final BigInteger eNeg = exponent.negate();
return new BigFraction(MathUtils.pow(denominator, eNeg),
MathUtils.pow(numerator, eNeg));
}
return new BigFraction(MathUtils.pow(numerator, exponent),
MathUtils.pow(denominator, exponent));
}
示例2: pow
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
* <p>
* Returns a <code>BigFraction</code> whose value is
* <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form.
* </p>
*
* @param exponent
* exponent to which this <code>BigFraction</code> is to be raised.
* @return <tt>this<sup>exponent</sup></tt> as a <code>BigFraction</code>.
*/
public BigFraction pow(final long exponent) {
if (exponent < 0) {
return new BigFraction(MathUtils.pow(denominator, -exponent),
MathUtils.pow(numerator, -exponent));
}
return new BigFraction(MathUtils.pow(numerator, exponent),
MathUtils.pow(denominator, exponent));
}
示例3: pow
import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
* <p>
* Returns a <code>BigFraction</code> whose value is
* <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form.
* </p>
*
* @param exponent
* exponent to which this <code>BigFraction</code> is to be raised.
* @return <tt>this<sup>exponent</sup></tt> as a <code>BigFraction</code>.
*/
public BigFraction pow(final BigInteger exponent) {
if (exponent.compareTo(BigInteger.ZERO) < 0) {
final BigInteger eNeg = exponent.negate();
return new BigFraction(MathUtils.pow(denominator, eNeg),
MathUtils.pow(numerator, eNeg));
}
return new BigFraction(MathUtils.pow(numerator, exponent),
MathUtils.pow(denominator, exponent));
}