/** * <p>Divide the value of this fraction by another.</p> * * @param fraction the fraction to divide by, must not be <code>null</code> * @return a <code>Fraction</code> instance with the resulting values * @throws IllegalArgumentException if the fraction is <code>null</code> * @throws ArithmeticException if the fraction to divide by is zero * @throws ArithmeticException if the resulting numerator or denominator exceeds * <code>Integer.MAX_VALUE</code> */ public Fraction divideBy(Fraction fraction) { if (fraction == null) { throw new IllegalArgumentException("The fraction must not be null"); } if (fraction.numerator == 0) { throw new ArithmeticException("The fraction to divide by must not be zero"); } return multiplyBy(fraction.invert()); }
/** * <p>Divide the value of this fraction by another.</p> * * @param fraction the fraction to divide by, must not be <code>null</code> * @return a <code>Fraction</code> instance with the resulting values * @throws IllegalArgumentException if the fraction is <code>null</code> * @throws ArithmeticException if the fraction to divide by is zero * @throws ArithmeticException if the resulting numerator or denominator exceeds * <code>Integer.MAX_VALUE</code> */ public Fraction divideBy(Fraction fraction) { if (fraction == null) { throw new IllegalArgumentException("The fraction must not be null"); } if (fraction.numerator == 0) { throw new ArithmeticException("The fraction to divide by must not be zero"); } return multiplyBy(fraction.invert()); }
/** * <p>Divide the value of this fraction by another.</p> * * @param fraction the fraction to divide by, must not be <code>null</code> * @return a <code>Fraction</code> instance with the resulting values * @throws IllegalArgumentException if the fraction is <code>null</code> * @throws ArithmeticException if the fraction to divide by is zero * @throws ArithmeticException if the resulting numerator or denominator exceeds * <code>Integer.MAX_VALUE</code> */ public Fraction divideBy(Fraction fraction) { if (fraction == null) { throw new IllegalArgumentException("The fraction must not be null"); } if (fraction.numerator == 0) { throw new ArithmeticException("The fraction to divide by must not be zero"); } return multiplyBy(fraction.invert()); }
/** * <p>Divide the value of this fraction by another.</p> * * @param fraction the fraction to divide by, must not be <code>null</code> * @return a <code>Fraction</code> instance with the resulting values * @throws IllegalArgumentException if the fraction is <code>null</code> * @throws ArithmeticException if the fraction to divide by is zero * @throws ArithmeticException if the resulting numerator or denominator exceeds * <code>Integer.MAX_VALUE</code> */ public Fraction divideBy(Fraction fraction) { if (fraction == null) { throw new IllegalArgumentException("The fraction must not be null"); } if (fraction.numerator == 0) { throw new ArithmeticException("The fraction to divide by must not be zero"); } return multiplyBy(fraction.invert()); }
/** * <p>Divide the value of this fraction by another.</p> * * @param fraction the fraction to divide by, must not be <code>null</code> * @return a <code>Fraction</code> instance with the resulting values * @throws IllegalArgumentException if the fraction is <code>null</code> * @throws ArithmeticException if the fraction to divide by is zero * @throws ArithmeticException if the resulting numerator or denominator exceeds * <code>Integer.MAX_VALUE</code> */ public Fraction divideBy(Fraction fraction) { if (fraction == null) { throw new IllegalArgumentException("The fraction must not be null"); } if (fraction.numerator == 0) { throw new ArithmeticException("The fraction to divide by must not be zero"); } return multiplyBy(fraction.invert()); }
/** * <p>Divide the value of this fraction by another.</p> * * @param fraction the fraction to divide by, must not be <code>null</code> * @return a <code>Fraction</code> instance with the resulting values * @throws IllegalArgumentException if the fraction is <code>null</code> * @throws ArithmeticException if the fraction to divide by is zero * @throws ArithmeticException if the resulting numerator or denominator exceeds * <code>Integer.MAX_VALUE</code> */ public Fraction divideBy(Fraction fraction) { if (fraction == null) { throw new IllegalArgumentException("The fraction must not be null"); } if (fraction.numerator == 0) { throw new ArithmeticException("The fraction to divide by must not be zero"); } return multiplyBy(fraction.invert()); }