MathContext (Java Platform SE 8 ) (original) (raw)


public final class MathContext
extends Object
implements Serializable
Immutable objects which encapsulate the context settings which describe certain rules for numerical operators, such as those implemented by the BigDecimal class.
The base-independent settings are:

  1. precision: the number of digits to be used for an operation; results are rounded to this precision
  2. roundingMode: a RoundingMode object which specifies the algorithm to be used for rounding.
    Since:
    1.5
    See Also:
    BigDecimal, RoundingMode, Serialized Form

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.