src/share/classes/java/math/MathContext.java
Print this page
@@ -124,23 +124,10 @@
* @see RoundingMode
* @serial
*/
final RoundingMode roundingMode;
- /**
- * Lookaside for the rounding points (the numbers which determine
- * whether the coefficient of a number will require rounding).
- * These will be present if {@code precision > 0} and
- * {@code precision <= MAX_LOOKASIDE}. In this case they will share the
- * {@code BigInteger int[]} array. Note that the transients
- * cannot be {@code final} because they are reconstructed on
- * deserialization.
- */
- transient BigInteger roundingMax = null;
- transient BigInteger roundingMin = null;
- private static final int MAX_LOOKASIDE = 1000;
-
/* ----- Constructors ----- */
/**
* Constructs a new {@code MathContext} with the specified
* precision and the {@link RoundingMode#HALF_UP HALF_UP} rounding
@@ -171,15 +158,10 @@
throw new IllegalArgumentException("Digits < 0");
if (setRoundingMode == null)
throw new NullPointerException("null RoundingMode");
precision = setPrecision;
- if (precision > 0 && precision <= MAX_LOOKASIDE) {
- roundingMax = BigInteger.TEN.pow(precision);
- roundingMin = roundingMax.negate();
- }
-
roundingMode = setRoundingMode;
return;
}
/**
@@ -219,15 +201,11 @@
if (setPrecision < MIN_DIGITS)
throw new IllegalArgumentException("Digits < 0");
// the other parameters cannot be invalid if we got here
precision = setPrecision;
- if (precision > 0 && precision <= MAX_LOOKASIDE) {
- roundingMax = BigInteger.TEN.pow(precision);
- roundingMin = roundingMax.negate();
}
- }
/**
* Returns the {@code precision} setting.
* This value is always non-negative.
*
@@ -341,13 +319,8 @@
}
if (roundingMode == null) {
String message = "MathContext: null roundingMode in stream";
throw new java.io.StreamCorruptedException(message);
}
- // Set the lookaside, if applicable
- if (precision <= MAX_LOOKASIDE) {
- roundingMax = BigInteger.TEN.pow(precision);
- roundingMin = roundingMax.negate();
}
- }
}