Modifier and Type | Method and Description |
---|---|
(package private) static long |
div128by64(DecimalRounding rounding,
boolean neg,
long u1,
long u0,
long v0)
PRECONDITION: Unsigned.isLess(u1, v0)
|
static long |
divide(DecimalArithmetic arith,
DecimalRounding rounding,
long uDecimalDividend,
long uDecimalDivisor)
Calculates
(uDecimalDividend * scaleFactor) / uDecimalDivisor
with rounding and without overflow checks. |
static long |
divide(DecimalArithmetic arith,
long uDecimalDividend,
long uDecimalDivisor)
Calculates
(uDecimalDividend * scaleFactor) / uDecimalDivisor
without rounding and overflow checks. |
static long |
divideByLong(DecimalRounding rounding,
long uDecimalDividend,
long lDivisor)
Calculates unchecked division by a long value with rounding.
|
static long |
divideByLongChecked(DecimalArithmetic arith,
DecimalRounding rounding,
long uDecimalDividend,
long lDivisor)
Calculates checked division by a long value with rounding.
|
static long |
divideByUnscaled(DecimalRounding rounding,
long uDecimalDividend,
long unscaledDivisor,
int scale)
Calculates unchecked division by an unscaled value with the given scale
without rounding.
|
static long |
divideByUnscaled(long uDecimalDividend,
long unscaledDivisor,
int scale)
Calculates unchecked division by an unscaled value with the given scale
without rounding and overflow checks.
|
static long |
divideByUnscaledChecked(DecimalArithmetic arith,
DecimalRounding rounding,
long uDecimalDividend,
long unscaledDivisor,
int scale)
Calculates unchecked division by an unscaled value with the given scale
without rounding and with overflow checks.
|
static long |
divideByUnscaledChecked(DecimalArithmetic arith,
long uDecimalDividend,
long unscaledDivisor,
int scale)
Calculates unchecked division by an unscaled value with the given scale
without rounding and with overflow checks.
|
static long |
divideChecked(DecimalArithmetic arith,
DecimalRounding rounding,
long uDecimalDividend,
long uDecimalDivisor)
Calculates
(uDecimalDividend * scaleFactor) / uDecimalDivisor
with rounding and with overflow checks. |
static long |
divideChecked(DecimalArithmetic arith,
long uDecimalDividend,
long uDecimalDivisor)
Calculates
(uDecimalDividend * scaleFactor) / uDecimalDivisor
without rounding and with overflow checks. |
public static final long divideByLong(DecimalRounding rounding, long uDecimalDividend, long lDivisor)
rounding
- the decimal rounding to apply if rounding is necessaryuDecimalDividend
- the unscaled decimal dividendlDivisor
- the long divisorpublic static final long divideByLongChecked(DecimalArithmetic arith, DecimalRounding rounding, long uDecimalDividend, long lDivisor)
arith
- the arithmetic used to format numbers when throwing exceptionsrounding
- the decimal rounding to apply if rounding is necessaryuDecimalDividend
- the unscaled decimal dividendlDivisor
- the long divisorpublic static final long divide(DecimalArithmetic arith, long uDecimalDividend, long uDecimalDivisor)
(uDecimalDividend * scaleFactor) / uDecimalDivisor
without rounding and overflow checks.arith
- the arithmetic with scale metrics and overflow modeuDecimalDividend
- the unscaled decimal dividenduDecimalDivisor
- the unscaled decimal divisorpublic static final long divideByUnscaled(long uDecimalDividend, long unscaledDivisor, int scale)
uDecimalDividend
- the unscaled decimal dividendunscaledDivisor
- the long divisorscale
- the scale of the divisorpublic static final long divide(DecimalArithmetic arith, DecimalRounding rounding, long uDecimalDividend, long uDecimalDivisor)
(uDecimalDividend * scaleFactor) / uDecimalDivisor
with rounding and without overflow checks.arith
- the arithmetic with scale metrics and overflow moderounding
- the decimal rounding to apply if rounding is necessaryuDecimalDividend
- the unscaled decimal dividenduDecimalDivisor
- the unscaled decimal divisorpublic static final long divideByUnscaled(DecimalRounding rounding, long uDecimalDividend, long unscaledDivisor, int scale)
rounding
- the rounding to applyuDecimalDividend
- the unscaled decimal dividendunscaledDivisor
- the long divisorscale
- the scale of the divisorpublic static final long divideChecked(DecimalArithmetic arith, long uDecimalDividend, long uDecimalDivisor)
(uDecimalDividend * scaleFactor) / uDecimalDivisor
without rounding and with overflow checks.arith
- the arithmetic with scale metrics and overflow modeuDecimalDividend
- the unscaled decimal dividenduDecimalDivisor
- the unscaled decimal divisorpublic static final long divideByUnscaledChecked(DecimalArithmetic arith, long uDecimalDividend, long unscaledDivisor, int scale)
arith
- the arithmetic associated with the dividenduDecimalDividend
- the unscaled decimal dividendunscaledDivisor
- the long divisorscale
- the scale of the divisorpublic static final long divideChecked(DecimalArithmetic arith, DecimalRounding rounding, long uDecimalDividend, long uDecimalDivisor)
(uDecimalDividend * scaleFactor) / uDecimalDivisor
with rounding and with overflow checks.arith
- the arithmetic with scale metrics and overflow moderounding
- the decimal rounding to apply if rounding is necessaryuDecimalDividend
- the unscaled decimal dividenduDecimalDivisor
- the unscaled decimal divisorpublic static final long divideByUnscaledChecked(DecimalArithmetic arith, DecimalRounding rounding, long uDecimalDividend, long unscaledDivisor, int scale)
arith
- the arithmetic associated with the dividendrounding
- the ronuding to applyuDecimalDividend
- the unscaled decimal dividendunscaledDivisor
- the long divisorscale
- the scale of the divisorstatic final long div128by64(DecimalRounding rounding, boolean neg, long u1, long u0, long v0)
Divides a 128 bit divisor by a 64 bit dividend and returns the signed 64
bit result. Rounding is applied if rounding != null
, otherwise
the value is truncated.
From www.codeproject.com.
neg
- true if result is negativeu1
- high order 64 bits of dividendu0
- low order 64 bits of dividendv0
- 64 bit divisorrounding
- rounding to apply, or null to truncate resultrounding != null