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

Gilles commented on MATH-1484:
------------------------------

Thanks for your report.
The [fraction 
functionality|https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-fraction]
 has been moved to the ["Commons 
Numbers"|https://commons.apache.org/proper/commons-numbers/] project.
Please move the issue to the corresponding [JIRA 
tracker|https://issues.apache.org/jira/projects/NUMBERS].

Patch, with unit tests, welcome.

> Fraction.add(int) and Fraction.subtract(int) ignore risk of integer overflow
> ----------------------------------------------------------------------------
>
>                 Key: MATH-1484
>                 URL: https://issues.apache.org/jira/browse/MATH-1484
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Heinrich Bohne
>            Priority: Minor
>
> The methods {{add(int)}} and {{subtract(int)}} in the class 
> {{org.apache.commons.math4.fraction.Fraction.java}} do not take into account 
> the risk of an integer overflow. For example, (2​^31^ - 1)/2 + 1 = (2​^31^ + 
> 1)/2, so the numerator overflows an {{int}}, but when calculated with 
> {{Fraction.add(int)}}, the method still returns normally.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to