Uses of Class
cc.redberry.rings.bigint.BigDecimal
Package | Description |
---|---|
cc.redberry.rings.bigint |
Provides classes for performing arbitrary-precision integer
arithmetic (
BigInteger ) and arbitrary-precision decimal
arithmetic (BigDecimal ). |
-
Uses of BigDecimal in cc.redberry.rings.bigint
Fields in cc.redberry.rings.bigint declared as BigDecimal Modifier and Type Field Description static BigDecimal
BigDecimal. ONE
The value 1, with a scale of 0.static BigDecimal
BigDecimal. TEN
The value 10, with a scale of 0.static BigDecimal
BigDecimal. ZERO
The value 0, with a scale of 0.Methods in cc.redberry.rings.bigint that return BigDecimal Modifier and Type Method Description BigDecimal
BigDecimal. abs()
Returns aBigDecimal
whose value is the absolute value of thisBigDecimal
, and whose scale isthis.scale()
.BigDecimal
BigDecimal. abs(MathContext mc)
Returns aBigDecimal
whose value is the absolute value of thisBigDecimal
, with rounding according to the context settings.BigDecimal
BigDecimal. add(BigDecimal augend)
Returns aBigDecimal
whose value is(this + augend)
, and whose scale ismax(this.scale(), augend.scale())
.BigDecimal
BigDecimal. add(BigDecimal augend, MathContext mc)
Returns aBigDecimal
whose value is(this + augend)
, with rounding according to the context settings.BigDecimal
BigDecimal. divide(BigDecimal divisor)
Returns aBigDecimal
whose value is(this / divisor)
, and whose preferred scale is(this.scale() - divisor.scale())
; if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) anArithmeticException
is thrown.BigDecimal
BigDecimal. divide(BigDecimal divisor, int roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale isthis.scale()
.BigDecimal
BigDecimal. divide(BigDecimal divisor, int scale, int roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale is as specified.BigDecimal
BigDecimal. divide(BigDecimal divisor, int scale, RoundingMode roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale is as specified.BigDecimal
BigDecimal. divide(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is(this / divisor)
, with rounding according to the context settings.BigDecimal
BigDecimal. divide(BigDecimal divisor, RoundingMode roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale isthis.scale()
.BigDecimal[]
BigDecimal. divideAndRemainder(BigDecimal divisor)
Returns a two-elementBigDecimal
array containing the result ofdivideToIntegralValue
followed by the result ofremainder
on the two operands.BigDecimal[]
BigDecimal. divideAndRemainder(BigDecimal divisor, MathContext mc)
Returns a two-elementBigDecimal
array containing the result ofdivideToIntegralValue
followed by the result ofremainder
on the two operands calculated with rounding according to the context settings.BigDecimal
BigDecimal. divideToIntegralValue(BigDecimal divisor)
Returns aBigDecimal
whose value is the integer part of the quotient(this / divisor)
rounded down.BigDecimal
BigDecimal. divideToIntegralValue(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is the integer part of(this / divisor)
.BigDecimal
BigDecimal. max(BigDecimal val)
Returns the maximum of thisBigDecimal
andval
.BigDecimal
BigDecimal. min(BigDecimal val)
Returns the minimum of thisBigDecimal
andval
.BigDecimal
BigDecimal. movePointLeft(int n)
Returns aBigDecimal
which is equivalent to this one with the decimal point movedn
places to the left.BigDecimal
BigDecimal. movePointRight(int n)
Returns aBigDecimal
which is equivalent to this one with the decimal point movedn
places to the right.BigDecimal
BigDecimal. multiply(BigDecimal multiplicand)
Returns aBigDecimal
whose value is (this × multiplicand), and whose scale is(this.scale() + multiplicand.scale())
.BigDecimal
BigDecimal. multiply(BigDecimal multiplicand, MathContext mc)
Returns aBigDecimal
whose value is (this × multiplicand), with rounding according to the context settings.BigDecimal
BigDecimal. negate()
Returns aBigDecimal
whose value is(-this)
, and whose scale isthis.scale()
.BigDecimal
BigDecimal. negate(MathContext mc)
Returns aBigDecimal
whose value is(-this)
, with rounding according to the context settings.BigDecimal
BigDecimal. plus()
Returns aBigDecimal
whose value is(+this)
, and whose scale isthis.scale()
.BigDecimal
BigDecimal. plus(MathContext mc)
Returns aBigDecimal
whose value is(+this)
, with rounding according to the context settings.BigDecimal
BigDecimal. pow(int n)
Returns aBigDecimal
whose value is (thisn), The power is computed exactly, to unlimited precision.BigDecimal
BigDecimal. pow(int n, MathContext mc)
Returns aBigDecimal
whose value is (thisn).BigDecimal
BigDecimal. remainder(BigDecimal divisor)
Returns aBigDecimal
whose value is(this % divisor)
.BigDecimal
BigDecimal. remainder(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is(this % divisor)
, with rounding according to the context settings.BigDecimal
BigDecimal. round(MathContext mc)
Returns aBigDecimal
rounded according to theMathContext
settings.BigDecimal
BigDecimal. scaleByPowerOfTen(int n)
Returns a BigDecimal whose numerical value is equal to (this
* 10n).BigDecimal
BigDecimal. setScale(int newScale)
Returns aBigDecimal
whose scale is the specified value, and whose value is numerically equal to thisBigDecimal
's.BigDecimal
BigDecimal. setScale(int newScale, int roundingMode)
Returns aBigDecimal
whose scale is the specified value, and whose unscaled value is determined by multiplying or dividing thisBigDecimal
's unscaled value by the appropriate power of ten to maintain its overall value.BigDecimal
BigDecimal. setScale(int newScale, RoundingMode roundingMode)
Returns aBigDecimal
whose scale is the specified value, and whose unscaled value is determined by multiplying or dividing thisBigDecimal
's unscaled value by the appropriate power of ten to maintain its overall value.BigDecimal
BigDecimal. stripTrailingZeros()
Returns aBigDecimal
which is numerically equal to this one but with any trailing zeros removed from the representation.BigDecimal
BigDecimal. subtract(BigDecimal subtrahend)
Returns aBigDecimal
whose value is(this - subtrahend)
, and whose scale ismax(this.scale(), subtrahend.scale())
.BigDecimal
BigDecimal. subtract(BigDecimal subtrahend, MathContext mc)
Returns aBigDecimal
whose value is(this - subtrahend)
, with rounding according to the context settings.BigDecimal
BigDecimal. ulp()
Returns the size of an ulp, a unit in the last place, of thisBigDecimal
.static BigDecimal
BigDecimal. valueOf(double val)
Translates adouble
into aBigDecimal
, using thedouble
's canonical string representation provided by theDouble.toString(double)
method.static BigDecimal
BigDecimal. valueOf(long val)
Translates along
value into aBigDecimal
with a scale of zero.static BigDecimal
BigDecimal. valueOf(long unscaledVal, int scale)
Translates along
unscaled value and anint
scale into aBigDecimal
.Methods in cc.redberry.rings.bigint with parameters of type BigDecimal Modifier and Type Method Description BigDecimal
BigDecimal. add(BigDecimal augend)
Returns aBigDecimal
whose value is(this + augend)
, and whose scale ismax(this.scale(), augend.scale())
.BigDecimal
BigDecimal. add(BigDecimal augend, MathContext mc)
Returns aBigDecimal
whose value is(this + augend)
, with rounding according to the context settings.int
BigDecimal. compareTo(BigDecimal val)
Compares thisBigDecimal
with the specifiedBigDecimal
.BigDecimal
BigDecimal. divide(BigDecimal divisor)
Returns aBigDecimal
whose value is(this / divisor)
, and whose preferred scale is(this.scale() - divisor.scale())
; if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) anArithmeticException
is thrown.BigDecimal
BigDecimal. divide(BigDecimal divisor, int roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale isthis.scale()
.BigDecimal
BigDecimal. divide(BigDecimal divisor, int scale, int roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale is as specified.BigDecimal
BigDecimal. divide(BigDecimal divisor, int scale, RoundingMode roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale is as specified.BigDecimal
BigDecimal. divide(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is(this / divisor)
, with rounding according to the context settings.BigDecimal
BigDecimal. divide(BigDecimal divisor, RoundingMode roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale isthis.scale()
.BigDecimal[]
BigDecimal. divideAndRemainder(BigDecimal divisor)
Returns a two-elementBigDecimal
array containing the result ofdivideToIntegralValue
followed by the result ofremainder
on the two operands.BigDecimal[]
BigDecimal. divideAndRemainder(BigDecimal divisor, MathContext mc)
Returns a two-elementBigDecimal
array containing the result ofdivideToIntegralValue
followed by the result ofremainder
on the two operands calculated with rounding according to the context settings.BigDecimal
BigDecimal. divideToIntegralValue(BigDecimal divisor)
Returns aBigDecimal
whose value is the integer part of the quotient(this / divisor)
rounded down.BigDecimal
BigDecimal. divideToIntegralValue(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is the integer part of(this / divisor)
.BigDecimal
BigDecimal. max(BigDecimal val)
Returns the maximum of thisBigDecimal
andval
.BigDecimal
BigDecimal. min(BigDecimal val)
Returns the minimum of thisBigDecimal
andval
.BigDecimal
BigDecimal. multiply(BigDecimal multiplicand)
Returns aBigDecimal
whose value is (this × multiplicand), and whose scale is(this.scale() + multiplicand.scale())
.BigDecimal
BigDecimal. multiply(BigDecimal multiplicand, MathContext mc)
Returns aBigDecimal
whose value is (this × multiplicand), with rounding according to the context settings.BigDecimal
BigDecimal. remainder(BigDecimal divisor)
Returns aBigDecimal
whose value is(this % divisor)
.BigDecimal
BigDecimal. remainder(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is(this % divisor)
, with rounding according to the context settings.BigDecimal
BigDecimal. subtract(BigDecimal subtrahend)
Returns aBigDecimal
whose value is(this - subtrahend)
, and whose scale ismax(this.scale(), subtrahend.scale())
.BigDecimal
BigDecimal. subtract(BigDecimal subtrahend, MathContext mc)
Returns aBigDecimal
whose value is(this - subtrahend)
, with rounding according to the context settings.