commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Resolved] (MATH-835) Fraction percentageValue rare overflow
Date Tue, 31 Jul 2012 15:01:36 GMT


Gilles resolved MATH-835.

       Resolution: Fixed
    Fix Version/s: 3.1

Fixed, as suggested, in revision 1367593.
Thanks for the report.

> Fraction percentageValue rare overflow
> --------------------------------------
>                 Key: MATH-835
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Baste Nesse Buanes
>            Priority: Minor
>              Labels: Fraction
>             Fix For: 3.1
>         Attachments: percentageValueOverflow.patch
> The percentageValue() method of the Fraction class works by first multiplying the Fraction
by 100, then converting the Fraction to a double. This causes overflows when the numerator
is greater than Integer.MAX_VALUE/100, even when the value of the fraction is far below this
> The patch changes the method to first convert to a double value, and then multiply this
value by 100 - the result should be the same, but with less overflows. An addition to the
test for the method that covers this bug is also included.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message