Osamu Ikeuchi created MATH-1261:
-----------------------------------
Summary: Overflow checks in Fraction multiply(int) / divide(int)
Key: MATH-1261
URL: https://issues.apache.org/jira/browse/MATH-1261
Project: Commons Math
Issue Type: Bug
Affects Versions: 3.5
Reporter: Osamu Ikeuchi
Priority: Minor
The member methods multiply(int) / divide(int) in the class
org.apache.commons.math3.fraction.Fraction do not have overflow checks.
return new Fraction(numerator * i, denominator);
should be
return new Fraction(ArithmeticUtils.mulAndCheck(numerator, i), denominator);
or, considering the case gcd(i, denominator) > 1,
return multiply(new Fraction(i));
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)