final class DoubleConversion extends Object
Modifier and Type | Method and Description |
---|---|
static long |
doubleToLong(DecimalRounding rounding,
double value)
Converts the specified double value to a long rounding the fractional part if necessary using the given
rounding mode. |
static long |
doubleToLong(double value)
Converts the specified double value to a long truncating the fractional part if any is present.
|
static long |
doubleToUnscaled(DecimalArithmetic arith,
DecimalRounding rounding,
double value)
Converts the specified double value to an unscaled decimal.
|
static long |
doubleToUnscaled(DecimalArithmetic arith,
double value)
Converts the specified double value to an unscaled decimal truncating extra fractional digits if necessary.
|
static double |
longToDouble(DecimalArithmetic arith,
DecimalRounding rounding,
long value)
Converts the specified long value to a double rounding extra mantissa digits if necessary.
|
static double |
longToDouble(DecimalArithmetic arith,
long value)
Converts the specified long value to a double truncating extra mantissa digits if necessary.
|
static double |
unscaledToDouble(DecimalArithmetic arith,
DecimalRounding rounding,
long unscaled)
Converts the specified unscaled decimal value to a double rounding extra precision digits if necessary.
|
static double |
unscaledToDouble(DecimalArithmetic arith,
long unscaled)
Converts the specified unscaled decimal value to a double truncating extra precision digits if necessary.
|
public static final long doubleToLong(double value)
value
- the value to convertIllegalArgumentException
- if value
is NaN or infinite or if the magnitude is too large for the double to be represented
as a long
public static final long doubleToLong(DecimalRounding rounding, double value)
rounding
mode. If the value is NaN, infinite or outside of the valid long range, an exception is thrown.rounding
- the rounding to apply if necessaryvalue
- the value to convertIllegalArgumentException
- if value
is NaN or infinite or if the magnitude is too large for the double to be represented
as a long
ArithmeticException
- if roundingMode==UNNECESSARY
and rounding is necessarypublic static final long doubleToUnscaled(DecimalArithmetic arith, double value)
arith
- the arithmetic associated with the result valuevalue
- the value to convertIllegalArgumentException
- if value
is NaN or infinite or if the magnitude is too large for the double to be represented
as a Decimal of the arithmetic's scalepublic static final long doubleToUnscaled(DecimalArithmetic arith, DecimalRounding rounding, double value)
rounding
mode is used if
rounding is necessary. If the value is NaN, infinite or outside of the valid Decimal range, an exception is
thrown.arith
- the arithmetic associated with the result valuerounding
- the rounding to apply if necessaryvalue
- the value to convertIllegalArgumentException
- if value
is NaN or infinite or if the magnitude is too large for the double to be represented
as a Decimal of the arithmetic's scaleArithmeticException
- if roundingMode==UNNECESSARY
and rounding is necessarypublic static final double longToDouble(DecimalArithmetic arith, long value)
arith
- the arithmetic associated with the valuevalue
- the long valuepublic static final double longToDouble(DecimalArithmetic arith, DecimalRounding rounding, long value)
arith
- the arithmetic associated with the valuerounding
- the rounding to apply if necessaryvalue
- the long valueArithmeticException
- if roundingMode==UNNECESSARY
and rounding is necessarypublic static final double unscaledToDouble(DecimalArithmetic arith, long unscaled)
arith
- the arithmetic associated with the valueunscaled
- the unscaled decimal valuepublic static final double unscaledToDouble(DecimalArithmetic arith, DecimalRounding rounding, long unscaled)
arith
- the arithmetic associated with the valuerounding
- the rounding to apply if necessaryunscaled
- the unscaled decimal valueArithmeticException
- if roundingMode==UNNECESSARY
and rounding is necessary