"Double.MAX_EXPONENT" and "Float.MAX_EXPONENT" are not available in Java 5.


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1243944 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gilles Sadowski 2012-02-14 14:34:11 +00:00
parent 8a83581eaf
commit 98bfd27d63
1 changed files with 2 additions and 2 deletions

View File

@ -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();
}