|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.math.MathContext
public final class MathContext
Immutable objects describing settings as rounding mode and digit precision
for the numerical operations provided by class BigDecimal.
| Field Summary | |
|---|---|
static MathContext |
DECIMAL128
A MathContext wich corresponds to the IEEE 754r quadruple decimal precision format: 34 digit preicision and HALF_EVEN rounding. |
static MathContext |
DECIMAL32
A MathContext wich corresponds to the IEEE 754r single decimal precision format: 7 digit preicision and HALF_EVEN rounding. |
static MathContext |
DECIMAL64
A MathContext wich corresponds to the IEEE 754r double decimal precision format: 16 digit preicision and HALF_EVEN rounding. |
static MathContext |
UNLIMITED
A MathContext for unlimited precision with HALF_UP rounding. |
| Constructor Summary | |
|---|---|
MathContext(int precision)
Constructs a new MathContext with the specified precision and with the rounding mode HALF_UP. |
|
MathContext(int precision,
RoundingMode roundingMode)
Constructs a new MathContext with the specified precision and with the specified rounding mode. |
|
MathContext(String val)
Constructs a new MathContext from a string. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object x)
Returns true if x is a MathContext with the same precision setting and the same rounding mode as this MathContext instance. |
int |
getPrecision()
Returns the precision. |
RoundingMode |
getRoundingMode()
Returns the rounding mode. |
int |
hashCode()
Returns the hash code for this MathContext instance. |
String |
toString()
Returns the string representation for this MathContext instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final MathContext DECIMAL32
public static final MathContext DECIMAL64
public static final MathContext DECIMAL128
public static final MathContext UNLIMITED
| Constructor Detail |
|---|
public MathContext(int precision)
precision - the precision for the new MathContext
IllegalArgumentException - if precision < 0.
public MathContext(int precision,
RoundingMode roundingMode)
precision - the precision for the new MathContextroundingMode - the rounding mode for the new MathContext
IllegalArgumentException - if precision < 0.
NullPointerException - if roundingMode is null.public MathContext(String val)
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.| Method Detail |
|---|
public int getPrecision()
public RoundingMode getRoundingMode()
public boolean equals(Object x)
equals in class Objectx - object to be compared
Object.hashCode()public int hashCode()
hashCode in class ObjectObject.equals(java.lang.Object)public String toString()
toString in class Object
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||