final class FloatConversion extends Object
Modifier and Type | Method and Description |
---|---|
static long |
floatToLong(DecimalRounding rounding,
float value)
Converts the specified float value to a long rounding the fractional part if necessary using the given
rounding mode. |
static long |
floatToLong(float value)
Converts the specified float value to a long truncating the fractional part if any is present.
|
static long |
floatToUnscaled(DecimalArithmetic arith,
DecimalRounding rounding,
float value)
Converts the specified float value to an unscaled decimal.
|
static long |
floatToUnscaled(DecimalArithmetic arith,
float value)
Converts the specified float value to an unscaled decimal truncating extra fractional digits if necessary.
|
static float |
longToFloat(DecimalArithmetic arith,
DecimalRounding rounding,
long value)
Converts the specified long value to a float rounding extra mantissa digits if necessary.
|
static float |
longToFloat(DecimalArithmetic arith,
long value)
Converts the specified long value to a float truncating extra mantissa digits if necessary.
|
static float |
unscaledToFloat(DecimalArithmetic arith,
DecimalRounding rounding,
long unscaled)
Converts the specified unscaled decimal value to a float rounding extra precision digits if necessary.
|
static float |
unscaledToFloat(DecimalArithmetic arith,
long unscaled)
Converts the specified unscaled decimal value to a float truncating extra precision digits if necessary.
|
public static final long floatToLong(float value)
value
- the value to convertIllegalArgumentException
- if value
is NaN or infinite or if the magnitude is too large for the float to be represented
as a long
public static final long floatToLong(DecimalRounding rounding, float 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 float to be represented
as a long
public static final long floatToUnscaled(DecimalArithmetic arith, float 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 float to be represented
as a Decimal of the arithmetic's scalepublic static final long floatToUnscaled(DecimalArithmetic arith, DecimalRounding rounding, float 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 float to be represented
as a Decimal of the arithmetic's scaleArithmeticException
- if roundingMode==UNNECESSARY
and rounding is necessarypublic static final float longToFloat(DecimalArithmetic arith, long value)
arith
- the arithmetic associated with the valuevalue
- the long valuepublic static final float longToFloat(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 float unscaledToFloat(DecimalArithmetic arith, long unscaled)
arith
- the arithmetic associated with the valueunscaled
- the unscaled decimal valuepublic static final float unscaledToFloat(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