Commons Math
  1. Commons Math
  2. MATH-340

BigFraction numerator constrainted by int size during multiplication

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Labels:
      None
    • Environment:

      All

      Description

      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);

        Activity

        Phil Steitz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Phil Steitz made changes -
        Fix Version/s 2.1 [ 12313444 ]
        Luc Maisonobe made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Luc Maisonobe added a comment -

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

        Show
        Luc Maisonobe added a comment - Fixed in subversion repository as of r906251. Thanks for the report.
        Matt Taylor created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Matt Taylor
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development