Java Code Examples for org.apache.commons.math.util.MathUtils#pow()

The following examples show how to use org.apache.commons.math.util.MathUtils#pow() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 2
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 3
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 4
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 5
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 6
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 7
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 8
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 9
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 10
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 11
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 12
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 13
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 14
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 15
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 16
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 17
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 18
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 19
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}
 
Example 20
Source File: BigFraction.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <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));
}