src/share/classes/java/math/MathContext.java

Print this page

        

*** 124,146 **** * @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 --- 124,133 ----
*** 171,185 **** 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; } /** --- 158,167 ----
*** 219,233 **** 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. * --- 201,211 ----
*** 341,353 **** } 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(); } - } } --- 319,326 ----