commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Baste Nesse Buanes (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MATH-835) Fraction percentageValue rare overflow
Date Tue, 31 Jul 2012 13:11:34 GMT

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

Baste Nesse Buanes updated MATH-835:
------------------------------------

    Attachment: percentageValueOverflow.patch
    
> Fraction percentageValue rare overflow
> --------------------------------------
>
>                 Key: MATH-835
>                 URL: https://issues.apache.org/jira/browse/MATH-835
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Baste Nesse Buanes
>            Priority: Minor
>         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
value.
> 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 is also included.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message