Uses of Class
java.math.MathContext
| Package | Description |
|---|---|
| java.math |
-
Uses of MathContext in java.math
Fields in java.math declared as MathContext Modifier and Type Field Description static MathContextMathContext. DECIMAL128AMathContextwhich corresponds to the IEEE 754 quadruple decimal precision format: 34 digit precision andRoundingMode.HALF_EVENrounding.static MathContextMathContext. DECIMAL32AMathContextwhich corresponds to the IEEE 754 single decimal precision format: 7 digit precision andRoundingMode.HALF_EVENrounding.static MathContextMathContext. DECIMAL64AMathContextwhich corresponds to the IEEE 754 double decimal precision format: 16 digit precision andRoundingMode.HALF_EVENrounding.static MathContextMathContext. UNLIMITEDAMathContextfor unlimited precision withRoundingMode.HALF_UProunding.Methods in java.math with parameters of type MathContext Modifier and Type Method Description BigDecimalBigDecimal. abs(MathContext mc)Returns aBigDecimalwhose value is the absolute value ofthis.BigDecimalBigDecimal. add(BigDecimal augend, MathContext mc)Returns a newBigDecimalwhose value isthis + augend.BigDecimalBigDecimal. divide(BigDecimal divisor, MathContext mc)Returns a newBigDecimalwhose value isthis / divisor.BigDecimal[]BigDecimal. divideAndRemainder(BigDecimal divisor, MathContext mc)Returns aBigDecimalarray which contains the integral part ofthis / divisorat index 0 and the remainderthis % divisorat index 1.BigDecimalBigDecimal. divideToIntegralValue(BigDecimal divisor, MathContext mc)Returns a newBigDecimalwhose value is the integral part ofthis / divisor.BigDecimalBigDecimal. multiply(BigDecimal multiplicand, MathContext mc)Returns a newBigDecimalwhose value isthis * multiplicand.BigDecimalBigDecimal. negate(MathContext mc)Returns a newBigDecimalwhose value is the-this.BigDecimalBigDecimal. plus(MathContext mc)Returns a newBigDecimalwhose value is+this.BigDecimalBigDecimal. pow(int n, MathContext mc)Returns a newBigDecimalwhose value isthis<sup>n</sup>.BigDecimalBigDecimal. remainder(BigDecimal divisor, MathContext mc)Returns a newBigDecimalwhose value isthis % divisor.BigDecimalBigDecimal. round(MathContext mc)Returns a newBigDecimalwhose value isthis, rounded according to the passed contextmc.BigDecimalBigDecimal. subtract(BigDecimal subtrahend, MathContext mc)Returns a newBigDecimalwhose value isthis - subtrahend.Constructors in java.math with parameters of type MathContext Constructor Description BigDecimal(char[] in, int offset, int len, MathContext mc)Constructs a newBigDecimalinstance from a string representation given as a character array.BigDecimal(char[] in, MathContext mc)Constructs a newBigDecimalinstance from a string representation given as a character array.BigDecimal(double val, MathContext mc)Constructs a newBigDecimalinstance from the 64bit doubleval.BigDecimal(int val, MathContext mc)Constructs a newBigDecimalinstance from the given intval.BigDecimal(long val, MathContext mc)Constructs a newBigDecimalinstance from the given longval.BigDecimal(String val, MathContext mc)Constructs a newBigDecimalinstance from a string representation.BigDecimal(BigInteger unscaledVal, int scale, MathContext mc)Constructs a newBigDecimalinstance from a given unscaled valueunscaledValand a given scale.BigDecimal(BigInteger val, MathContext mc)Constructs a newBigDecimalinstance from the given big integerval.