Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#ZERO_FRACTION_TO_DIVIDE_BY

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#ZERO_FRACTION_TO_DIVIDE_BY . 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: Math_1_Fraction_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 2
Source File: Math_1_Fraction_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 3
Source File: Math_27_Fraction_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 4
Source File: Math_27_Fraction_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 5
Source File: Math_26_Fraction_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 6
Source File: Math_26_Fraction_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 7
Source File: Fraction.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 8
Source File: Fraction.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 9
Source File: Fraction.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 10
Source File: Fraction.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 11
Source File: Fraction.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 12
Source File: Fraction.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 13
Source File: Fraction.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}
 
Example 14
Source File: Fraction.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>Divide the value of this fraction by another.</p>
 *
 * @param fraction  the fraction to divide by, must not be {@code null}
 * @return a {@code Fraction} instance with the resulting values
 * @throws IllegalArgumentException if the fraction is {@code null}
 * @throws MathArithmeticException if the fraction to divide by is zero
 * @throws MathArithmeticException if the resulting numerator or denominator exceeds
 *  {@code Integer.MAX_VALUE}
 */
public Fraction divide(Fraction fraction) {
    if (fraction == null) {
        throw new NullArgumentException(LocalizedFormats.FRACTION);
    }
    if (fraction.numerator == 0) {
        throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                                          fraction.numerator, fraction.denominator);
    }
    return multiply(fraction.reciprocal());
}