Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.0
-
None
Description
The Fraction.multiplyBy and divideBy methods fail sometimes when the arguments are not reduced.
FunctionTest.java
public void testMultiply() { // ... f1 = Fraction.getFraction(Integer.MAX_VALUE, Integer.MAX_VALUE); f2 = Fraction.getFraction(42, 1); f = f1.multiplyBy(f2); assertEquals(42, f.getNumerator()); assertEquals(1, f.getDenominator()); public void testDivide() { // ... f1 = Fraction.getFraction(Integer.MAX_VALUE, Integer.MAX_VALUE); f2 = Fraction.getFraction(42, 1); f = f1.divideBy(f2); assertEquals(1, f.getNumerator()); assertEquals(42, f.getDenominator());