commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (MATH-1029) Creating BigFraction objects is not consistent for negative/positive values
Date Thu, 17 Oct 2013 21:14:42 GMT

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

Thomas Neidhart resolved MATH-1029.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 3.3

Fixed in r1533260 by checking the absolute value of the parameter for overflow.

> Creating BigFraction objects is not consistent for negative/positive values
> ---------------------------------------------------------------------------
>
>                 Key: MATH-1029
>                 URL: https://issues.apache.org/jira/browse/MATH-1029
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Thomas Neidhart
>            Assignee: Thomas Neidhart
>            Priority: Minor
>             Fix For: 3.3
>
>
> Creating a BigFraction object for large integer values will return different results
whether the argument is positive or negative:
> {noformat}
>   BigFraction f1 = new BigFraction(-1e10, 1000); -> will return a fraction with a
numerator of -1e10 and denominator of 1
>   BigFraction f2 = new BigFraction(1e10, 1000); -> will throw a FractionConversionException
> {noformat}
> the problem is in the check for overflow, it is not done on the absolute value of the
argument, also it should be done only after the check if the argument is actually an integer.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message