Author: erans
Date: Tue Feb 14 14:34:11 2012
New Revision: 1243944
URL: http://svn.apache.org/viewvc?rev=1243944&view=rev
Log:
MATH-744
"Double.MAX_EXPONENT" and "Float.MAX_EXPONENT" are not available in Java 5.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java?rev=1243944&r1=1243943&r2=1243944&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java
Tue Feb 14 14:34:11 2012
@@ -687,7 +687,7 @@ public class BigFraction
// Numerator and/or denominator must be out of range:
// Calculate how far to shift them to put them in range.
int shift = Math.max(numerator.bitLength(),
- denominator.bitLength()) -
Double.MAX_EXPONENT;
+ denominator.bitLength()) -
FastMath.getExponent(Double.MAX_VALUE);
result = numerator.shiftRight(shift).doubleValue() /
denominator.shiftRight(shift).doubleValue();
}
@@ -740,7 +740,7 @@ public class BigFraction
// Numerator and/or denominator must be out of range:
// Calculate how far to shift them to put them in range.
int shift = Math.max(numerator.bitLength(),
- denominator.bitLength()) - Float.MAX_EXPONENT;
+ denominator.bitLength()) -
FastMath.getExponent(Float.MAX_VALUE);
result = numerator.shiftRight(shift).floatValue() /
denominator.shiftRight(shift).floatValue();
}