| java.lang.Object | |
| ↳ | java.math.MathContext |
Immutable objects describing settings as rounding mode and digit precision
for the numerical operations provided by class BigDecimal.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| MathContext | DECIMAL128 | A MathContext wich corresponds to the IEEE 754r quadruple decimal precision format: 34 digit preicision and HALF_EVEN rounding. | |||||||||
| MathContext | DECIMAL32 | A MathContext wich corresponds to the IEEE 754r single decimal precision format: 7 digit preicision and HALF_EVEN rounding. | |||||||||
| MathContext | DECIMAL64 | A MathContext wich corresponds to the IEEE 754r double decimal precision format: 16 digit preicision and HALF_EVEN rounding. | |||||||||
| MathContext | UNLIMITED | A MathContext for unlimited precision with HALF_UP rounding. | |||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new MathContext with the specified precision and with
the rounding mode HALF_UP.
| |||||||||||
Constructs a new MathContext with the specified precision and with
the specified rounding mode.
| |||||||||||
Constructs a new MathContext from a string.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns true if x is a MathContext with the same precision setting
and the same rounding mode as this MathContext instance.
| |||||||||||
Returns the precision.
| |||||||||||
Returns the rounding mode.
| |||||||||||
Returns the hash code for this MathContext instance.
| |||||||||||
Returns the string representation for this MathContext instance.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
A MathContext wich corresponds to the IEEE 754r quadruple decimal precision format: 34 digit preicision and HALF_EVEN rounding.
A MathContext wich corresponds to the IEEE 754r single decimal precision format: 7 digit preicision and HALF_EVEN rounding.
A MathContext wich corresponds to the IEEE 754r double decimal precision format: 16 digit preicision and HALF_EVEN rounding.
A MathContext for unlimited precision with HALF_UP rounding.
Constructs a new MathContext with the specified precision and with the rounding mode HALF_UP. If the precision passed is zero, then this implies that the computations have to be performed exact, the rounding mode in this case is irrelevant.
| precision | the precision for the new MathContext |
|---|
| IllegalArgumentException | if precision < 0. |
|---|
Constructs a new MathContext with the specified precision and with the specified rounding mode. If the precision passed is zero, then this implies that the computations have to be performed exact, the rounding mode in this case is irrelevant.
| precision | the precision for the new MathContext |
|---|---|
| roundingMode | the rounding mode for the new MathContext |
| IllegalArgumentException | if precision < 0. |
|---|---|
| NullPointerException | if roundingMode is null. |
Constructs a new MathContext from a string. The string has to
specify the precision and the rounding mode to be used and has
to follow the following syntax:
"precision=
| val | a string describing the precision and rounding mode for the new MathContext. |
|---|
| IllegalArgumentException | if the String is not in the correct format or if the precision specified is < 0. |
|---|
Returns true if x is a MathContext with the same precision setting and the same rounding mode as this MathContext instance.
| x | object to be compared |
|---|
Returns the precision. The precision is the number of digits used for an operation. Results are rounded to this precision. The precision is guaranteed to be non negative. If the precision is zero, then the computations have to be performed exact, results are not rounded in this case.
Returns the rounding mode. The rounding mode is the strategy to be used to round results. The rounding mode is one of RoundingMode.UP, RoundingMode.DOWN, RoundingMode.CEILING, RoundingMode.FLOOR, RoundingMode.HALF_UP, RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN, or oundingMode.UNNECESSARY.
Returns the hash code for this MathContext instance.
Returns the string representation for this MathContext instance.
The string has the form
"precision=