示例#1
0
 /**
  * Returns a <code>BigFraction</code> whose value is <tt>(this<sup>exponent</sup>)</tt>, returning
  * the result in reduced form.
  *
  * @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(
         ArithmeticUtils.pow(denominator, -exponent), ArithmeticUtils.pow(numerator, -exponent));
   }
   return new BigFraction(
       ArithmeticUtils.pow(numerator, exponent), ArithmeticUtils.pow(denominator, exponent));
 }
示例#2
0
 /**
  * Returns a <code>BigFraction</code> whose value is <tt>(this<sup>exponent</sup>)</tt>, returning
  * the result in reduced form.
  *
  * @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(
         ArithmeticUtils.pow(denominator, eNeg), ArithmeticUtils.pow(numerator, eNeg));
   }
   return new BigFraction(
       ArithmeticUtils.pow(numerator, exponent), ArithmeticUtils.pow(denominator, exponent));
 }