commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Osamu Ikeuchi (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MATH-1261) Overflow checks in Fraction multiply(int) / divide(int)
Date Thu, 20 Aug 2015 14:54:46 GMT

     [ https://issues.apache.org/jira/browse/MATH-1261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Osamu Ikeuchi updated MATH-1261:
--------------------------------
    Affects Version/s:     (was: 3.5)

> 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
>            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.
> {code:java}
> return new Fraction(numerator * i, denominator);
> {code}
> should be
> {code:java}
> return new Fraction(ArithmeticUtils.mulAndCheck(numerator, i), denominator);
> {code}
> or, considering the case gcd(i, denominator) > 1,
> {code:java}
> return multiply(new Fraction(i));
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message