commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (MATH-340) BigFraction numerator constrainted by int size during multiplication
Date Wed, 03 Feb 2010 21:21:28 GMT

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

Luc Maisonobe resolved MATH-340.
--------------------------------

    Resolution: Fixed

Fixed in subversion repository as of r906251.
Thanks for the report.

> BigFraction numerator constrainted by int size during multiplication
> --------------------------------------------------------------------
>
>                 Key: MATH-340
>                 URL: https://issues.apache.org/jira/browse/MATH-340
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: All
>            Reporter: Matt Taylor
>
> When multiplying two BigFraction objects with numerators larger than will fit in an java-primitive
int the result of BigFraction.ZERO is incorrectly returned.
> Test Case:
> 	        BigFraction fractionA = new BigFraction(0.00131);
> 	        BigFraction fractionB = new BigFraction(.37).reciprocal();
> 	        BigFraction errorResult = fractionA.multiply(fractionB);
> 	        System.out.println("Error Result: " + errorResult);
> 		BigFraction correctResult = new BigFraction(fractionA.getNumerator().multiply(fractionB.getNumerator()),
fractionA.getDenominator().multiply(fractionB.getDenominator()));
> 	        System.out.println("Correct Result: " + correctResult);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message