You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Osamu Ikeuchi (JIRA)" <ji...@apache.org> on 2015/08/21 00:57:46 UTC

[jira] [Commented] (MATH-1261) Overflow checks in Fraction multiply(int) / divide(int)

    [ https://issues.apache.org/jira/browse/MATH-1261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14705931#comment-14705931 ] 

Osamu Ikeuchi commented on MATH-1261:
-------------------------------------

Hi Gilles. Thank you very much for your quick reply and fixing.

> 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
>             Fix For: 4.0, 3.6
>
>
> 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)