commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Taylor (JIRA)" <>
Subject [jira] Created: (MATH-340) BigFraction numerator constrainted by int size during multiplication
Date Wed, 03 Feb 2010 20:19:27 GMT
BigFraction numerator constrainted by int size during multiplication

                 Key: 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()),
	        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.

View raw message