[jira] Created: (MATH-340) BigFraction numerator constrainted by int size during multiplication

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (MATH-340) BigFraction numerator constrainted by int size during multiplication

ASF GitHub Bot (Jira)
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.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (MATH-340) BigFraction numerator constrainted by int size during multiplication

ASF GitHub Bot (Jira)

     [ 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (MATH-340) BigFraction numerator constrainted by int size during multiplication

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Phil Steitz closed MATH-340.
----------------------------


> 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
>             Fix For: 2.1
>
>
> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (MATH-340) BigFraction numerator constrainted by int size during multiplication

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Phil Steitz updated MATH-340:
-----------------------------

    Fix Version/s: 2.1

> 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
>             Fix For: 2.1
>
>
> 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.