public abstract class AbstractCheckedArithmetic extends AbstractArithmetic
CHECKED
overflow mode.Constructor and Description |
---|
AbstractCheckedArithmetic() |
Modifier and Type | Method and Description |
---|---|
long |
abs(long uDecimal)
Returns an unscaled decimal whose value is
abs(uDecimal) , which is the value itself if
uDecimal>=0 and -uDecimal if the given value is negative. |
long |
add(long uDecimal1,
long uDecimal2)
Returns an unscaled decimal whose value is
(uDecimal1 + uDecimal2) . |
OverflowMode |
getOverflowMode()
Returns the overflow mode applied to operations of this
DecimalArithmetic object if an overflow
occurs. |
abstract CheckedRounding |
getTruncationPolicy()
Returns the truncation policy defining how to handle truncation due to overflow or rounding.
|
long |
multiplyByLong(long uDecimal,
long lValue)
Returns an unscaled decimal whose value is
(uDecimal * lValue) where the second argument is a true long
value instead of an unscaled decimal. |
long |
negate(long uDecimal)
Returns an unscaled decimal whose value is
-uDecimal . |
long |
subtract(long uDecimalMinuend,
long uDecimalSubtrahend)
Returns an unscaled decimal whose value is
(uDecimalMinuend -
uDecimalSubtrahend) . |
compare, compareToUnscaled, deriveArithmetic, deriveArithmetic, deriveArithmetic, deriveArithmetic, deriveArithmetic, fromBigInteger, signum, toBigDecimal, toBigDecimal
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLong, addUnscaled, avg, divide, divideByLong, divideByPowerOf10, divideByUnscaled, fromBigDecimal, fromDouble, fromFloat, fromLong, fromUnscaled, getRoundingMode, getScale, getScaleMetrics, invert, multiply, multiplyByPowerOf10, multiplyByUnscaled, one, parse, parse, pow, round, shiftLeft, shiftRight, sqrt, square, subtractLong, subtractUnscaled, toDouble, toFloat, toLong, toString, toString, toUnscaled
public AbstractCheckedArithmetic()
public abstract CheckedRounding getTruncationPolicy()
DecimalArithmetic
TruncationPolicy
is defined by the overflow mode
and the
rounding mode
.DecimalArithmetic
handles truncationpublic final OverflowMode getOverflowMode()
DecimalArithmetic
DecimalArithmetic
object if an overflow
occurs. The overflow mode defines whether an operation should throw an exception if an overflow occurs.DecimalArithmetic
object if an overflow occurspublic final long add(long uDecimal1, long uDecimal2)
DecimalArithmetic
(uDecimal1 + uDecimal2)
.uDecimal1
- first unscaled decimal value to be addeduDecimal2
- second unscaled decimal value to be addeduDecimal1 + uDecimal2
public final long subtract(long uDecimalMinuend, long uDecimalSubtrahend)
DecimalArithmetic
(uDecimalMinuend -
uDecimalSubtrahend)
.uDecimalMinuend
- unscaled decimal value to subtract fromuDecimalSubtrahend
- unscaled decimal value to subtract from the minuenduDecimalMinuend - uDecimalSubtrahend
public final long multiplyByLong(long uDecimal, long lValue)
DecimalArithmetic
(uDecimal * lValue)
where the second argument is a true long
value instead of an unscaled decimal.uDecimal
- unscaled decimal value to be multipliedlValue
- long value to be multiplieduDecimal * lValue
public final long abs(long uDecimal)
DecimalArithmetic
abs(uDecimal)
, which is the value itself if
uDecimal>=0
and -uDecimal
if the given value is negative.uDecimal
- the unscaled decimal valueabs(uDecimal)
public final long negate(long uDecimal)
DecimalArithmetic
-uDecimal
.uDecimal
- the unscaled decimal value to negate-uDecimal