public final class Decimal10f extends AbstractImmutableDecimal<Scale10f,Decimal10f>
All methods for this class throw NullPointerException
when passed a
null
object reference for any input parameter.
Modifier and Type | Field and Description |
---|---|
static Decimal10f |
BILLIONTH
The
Decimal10f constant 10-9. |
static DecimalArithmetic |
DEFAULT_ARITHMETIC
Default arithmetic for
Decimal10f performing unchecked operations with rounding mode
HALF_UP . |
static DecimalArithmetic |
DEFAULT_CHECKED_ARITHMETIC
Default arithmetic for
Decimal10f performing checked operations with rounding mode
HALF_UP . |
static Decimal10f |
EIGHT
The
Decimal10f constant 8. |
static Factory10f |
FACTORY
Factory constant for
Decimal10f returned by getFactory() . |
static Decimal10f |
FIVE
The
Decimal10f constant 5. |
static Decimal10f |
FOUR
The
Decimal10f constant 4. |
static Decimal10f |
HALF
The
Decimal10f constant 0.5. |
static Decimal10f |
HUNDRED
The
Decimal10f constant 100. |
static Decimal10f |
HUNDREDTH
The
Decimal10f constant 0.01. |
static Decimal10f |
MAX_INTEGER_VALUE
A constant holding the maximum integer value a
Decimal10f
can have, 922337203.0000000000. |
static Decimal10f |
MAX_VALUE
A constant holding the maximum value a
Decimal10f can have,
922337203.6854775807. |
static Scale10f |
METRICS
Scale metrics constant for
Decimal10f returned by getScaleMetrics() . |
static Decimal10f |
MILLION
The
Decimal10f constant 106. |
static Decimal10f |
MILLIONTH
The
Decimal10f constant 10-6. |
static Decimal10f |
MIN_INTEGER_VALUE
A constant holding the minimum integer value a
Decimal10f
can have, -922337203.0000000000. |
static Decimal10f |
MIN_VALUE
A constant holding the minimum value a
Decimal10f can have,
-922337203.6854775808. |
static Decimal10f |
MINUS_ONE
The
Decimal10f constant -1. |
static Decimal10f |
NINE
The
Decimal10f constant 9. |
static Decimal10f |
ONE
The
Decimal10f constant 1. |
static long |
ONE_UNSCALED
The unscaled long value that represents one.
|
static int |
SCALE
Scale value 10 for
Decimal10f returned by getScale() . |
static Decimal10f |
SEVEN
The
Decimal10f constant 7. |
static Decimal10f |
SIX
The
Decimal10f constant 6. |
static Decimal10f |
TEN
The
Decimal10f constant 10. |
static Decimal10f |
TENTH
The
Decimal10f constant 0.1. |
static Decimal10f |
THOUSAND
The
Decimal10f constant 1000. |
static Decimal10f |
THOUSANDTH
The
Decimal10f constant 0.001. |
static Decimal10f |
THREE
The
Decimal10f constant 3. |
static Decimal10f |
TWO
The
Decimal10f constant 2. |
static Decimal10f |
ULP
A constant holding the smallest positive value a
Decimal10f
can have, 10-10. |
static Decimal10f |
ZERO
The
Decimal10f constant zero. |
Constructor and Description |
---|
Decimal10f(String value)
Translates the string representation of a
Decimal into a
Decimal10f . |
Modifier and Type | Method and Description |
---|---|
protected Decimal10f |
create(long unscaled)
Returns a new
Decimal whose value is
(unscaled × 10-scale). |
protected Decimal10f[] |
createArray(int length)
Returns a new
Decimal array of the specified length . |
protected Decimal10f |
createOrAssign(long unscaled)
Returns this or a new
Decimal whose value is
(unscaled × 10-scale). |
protected DecimalArithmetic |
getDefaultArithmetic()
Returns the default arithmetic performing unchecked operations with
rounding mode
HALF_UP . |
protected DecimalArithmetic |
getDefaultCheckedArithmetic()
Returns the default arithmetic performing checked operations with
rounding mode
HALF_UP . |
Factory10f |
getFactory()
Returns the factory that can be used to create other Decimal values of the same scale as
this Decimal. |
protected DecimalArithmetic |
getRoundingDownArithmetic()
Returns the arithmetic performing unchecked operations with rounding mode
DOWN . |
protected DecimalArithmetic |
getRoundingFloorArithmetic()
Returns the arithmetic performing unchecked operations with rounding mode
FLOOR . |
protected DecimalArithmetic |
getRoundingHalfEvenArithmetic()
Returns the arithmetic performing unchecked operations with rounding mode
HALF_EVEN . |
protected DecimalArithmetic |
getRoundingUnnecessaryArithmetic()
Returns the arithmetic performing unchecked operations with rounding mode
UNNECESSARY . |
int |
getScale()
Returns the scale associated with this Decimal.
|
Scale10f |
getScaleMetrics()
Returns the metrics associated with the scale of this Decimal.
|
Multipliable10f |
multiplyExact()
Returns this
Decimal as a multipliable factor for typed
exact multiplication. |
protected Decimal10f |
self()
Returns
this decimal value as concrete implementation subtype. |
Decimal10f |
toImmutableDecimal()
If this
Decimal value is already an ImmutableDecimal it is simply returned. |
MutableDecimal10f |
toMutableDecimal()
If this
Decimal value is already a MutableDecimal it is simply returned. |
static Decimal10f |
valueOf(BigDecimal value)
Returns a
Decimal10f whose value is calculated by rounding
the specified BigDecimal argument to scale 10 using
HALF_UP rounding. |
static Decimal10f |
valueOf(BigDecimal value,
RoundingMode roundingMode)
Returns a
Decimal10f whose value is calculated by rounding
the specified BigDecimal argument to scale 10 using
the specified roundingMode . |
static Decimal10f |
valueOf(BigInteger value)
Returns a
Decimal10f whose value is numerically equal to that of
the specified BigInteger value. |
static Decimal10f |
valueOf(Decimal<?> value)
|
static Decimal10f |
valueOf(Decimal<?> value,
RoundingMode roundingMode)
Returns a
Decimal10f whose value is calculated by rounding
the specified Decimal argument to scale 10 using
the specified roundingMode . |
static Decimal10f |
valueOf(double value)
Returns a
Decimal10f whose value is calculated by
rounding the specified double argument to scale 10
using HALF_UP rounding. |
static Decimal10f |
valueOf(double value,
RoundingMode roundingMode)
Returns a
Decimal10f whose value is calculated by
rounding the specified double argument to scale 10
using the specified roundingMode . |
static Decimal10f |
valueOf(float value)
Returns a
Decimal10f whose value is calculated by
rounding the specified float argument to scale 10
using HALF_UP rounding. |
static Decimal10f |
valueOf(float value,
RoundingMode roundingMode)
Returns a
Decimal10f whose value is calculated by
rounding the specified float argument to scale 10
using the specified roundingMode . |
static Decimal10f |
valueOf(long value)
Returns a
Decimal10f whose value is numerically equal to
that of the specified long value. |
static Decimal10f |
valueOf(String value)
Translates the string representation of a
Decimal into a
Decimal10f . |
static Decimal10f |
valueOf(String value,
RoundingMode roundingMode)
Translates the string representation of a
Decimal into a
Decimal10f . |
static Decimal10f |
valueOfUnscaled(long unscaledValue)
Returns a
Decimal10f whose value is numerically equal to
(unscaledValue × 10-10). |
static Decimal10f |
valueOfUnscaled(long unscaledValue,
int scale)
Returns a
Decimal10f whose value is numerically equal to
(unscaledValue × 10-scale). |
static Decimal10f |
valueOfUnscaled(long unscaledValue,
int scale,
RoundingMode roundingMode)
Returns a
Decimal10f whose value is numerically equal to
(unscaledValue × 10-scale). |
max, min, multiplyExact, scale, scale, scale, scale, toString, unscaledValue
abs, abs, add, add, add, add, add, add, add, add, addSquared, addSquared, addSquared, addUnscaled, addUnscaled, addUnscaled, addUnscaled, addUnscaled, avg, avg, byteValueExact, compareTo, compareToNumerically, divide, divide, divide, divide, divide, divide, divide, divide, divideAndRemainder, divideAndRemainder, divideBy, divideBy, divideBy, divideByPowerOfTen, divideByPowerOfTen, divideByPowerOfTen, divideExact, divideToIntegralValue, divideToIntegralValue, divideToLongValue, divideToLongValue, divideTruncate, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, doubleValue, doubleValue, equals, floatValue, floatValue, fractionalPart, getArithmeticFor, getArithmeticFor, getArithmeticFor, getCheckedArithmeticFor, hashCode, integralPart, intValue, intValueExact, invert, invert, invert, isBetweenZeroAndMinusOne, isBetweenZeroAndOne, isEqualTo, isEqualToNumerically, isGreaterThan, isGreaterThanOrEqualTo, isIntegral, isIntegralPartZero, isLessThan, isLessThanOrEqualTo, isMinusOne, isNegative, isNonNegative, isNonPositive, isOne, isPositive, isUlp, isZero, longValue, longValue, longValueExact, max, max, min, min, multiply, multiply, multiply, multiply, multiply, multiply, multiply, multiplyBy, multiplyBy, multiplyBy, multiplyByPowerOfTen, multiplyByPowerOfTen, multiplyByPowerOfTen, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, negate, negate, pow, pow, pow, remainder, round, round, round, shiftLeft, shiftLeft, shiftLeft, shiftRight, shiftRight, shiftRight, shortValueExact, signum, sqrt, sqrt, square, square, square, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtractSquared, subtractSquared, subtractSquared, subtractUnscaled, subtractUnscaled, subtractUnscaled, subtractUnscaled, subtractUnscaled, toBigDecimal, toBigDecimal, toBigInteger, toBigInteger, toBigIntegerExact
byteValue, shortValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
abs, abs, add, add, add, add, add, add, add, add, addSquared, addSquared, addSquared, addUnscaled, addUnscaled, addUnscaled, addUnscaled, addUnscaled, avg, avg, divide, divide, divide, divide, divide, divide, divide, divide, divideAndRemainder, divideAndRemainder, divideBy, divideBy, divideBy, divideByPowerOfTen, divideByPowerOfTen, divideByPowerOfTen, divideExact, divideToIntegralValue, divideToIntegralValue, divideTruncate, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, divideUnscaled, fractionalPart, integralPart, invert, invert, invert, multiply, multiply, multiply, multiply, multiply, multiply, multiply, multiplyBy, multiplyBy, multiplyBy, multiplyByPowerOfTen, multiplyByPowerOfTen, multiplyByPowerOfTen, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, multiplyUnscaled, negate, negate, pow, pow, pow, remainder, round, round, round, shiftLeft, shiftLeft, shiftLeft, shiftRight, shiftRight, shiftRight, sqrt, sqrt, square, square, square, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtractSquared, subtractSquared, subtractSquared, subtractUnscaled, subtractUnscaled, subtractUnscaled, subtractUnscaled, subtractUnscaled
byteValue, byteValueExact, compareTo, compareToNumerically, divideToLongValue, divideToLongValue, doubleValue, doubleValue, equals, floatValue, floatValue, hashCode, intValue, intValueExact, isBetweenZeroAndMinusOne, isBetweenZeroAndOne, isEqualTo, isEqualToNumerically, isGreaterThan, isGreaterThanOrEqualTo, isIntegral, isIntegralPartZero, isLessThan, isLessThanOrEqualTo, isMinusOne, isNegative, isNonNegative, isNonPositive, isOne, isPositive, isUlp, isZero, longValue, longValue, longValueExact, max, min, shortValue, shortValueExact, signum, toBigDecimal, toBigDecimal, toBigInteger, toBigInteger, toBigIntegerExact
public static final int SCALE
Decimal10f
returned by getScale()
.public static final Scale10f METRICS
Decimal10f
returned by getScaleMetrics()
.public static final Factory10f FACTORY
Decimal10f
returned by getFactory()
.public static final DecimalArithmetic DEFAULT_ARITHMETIC
Decimal10f
performing unchecked operations with rounding mode
HALF_UP
.public static final DecimalArithmetic DEFAULT_CHECKED_ARITHMETIC
Decimal10f
performing checked operations with rounding mode
HALF_UP
.public static final long ONE_UNSCALED
public static final Decimal10f ZERO
Decimal10f
constant zero.public static final Decimal10f ULP
Decimal10f
can have, 10-10.public static final Decimal10f ONE
Decimal10f
constant 1.public static final Decimal10f TWO
Decimal10f
constant 2.public static final Decimal10f THREE
Decimal10f
constant 3.public static final Decimal10f FOUR
Decimal10f
constant 4.public static final Decimal10f FIVE
Decimal10f
constant 5.public static final Decimal10f SIX
Decimal10f
constant 6.public static final Decimal10f SEVEN
Decimal10f
constant 7.public static final Decimal10f EIGHT
Decimal10f
constant 8.public static final Decimal10f NINE
Decimal10f
constant 9.public static final Decimal10f TEN
Decimal10f
constant 10.public static final Decimal10f HUNDRED
Decimal10f
constant 100.public static final Decimal10f THOUSAND
Decimal10f
constant 1000.public static final Decimal10f MILLION
Decimal10f
constant 106.public static final Decimal10f MINUS_ONE
Decimal10f
constant -1.public static final Decimal10f HALF
Decimal10f
constant 0.5.public static final Decimal10f TENTH
Decimal10f
constant 0.1.public static final Decimal10f HUNDREDTH
Decimal10f
constant 0.01.public static final Decimal10f THOUSANDTH
Decimal10f
constant 0.001.public static final Decimal10f MILLIONTH
Decimal10f
constant 10-6.public static final Decimal10f BILLIONTH
Decimal10f
constant 10-9.public static final Decimal10f MAX_VALUE
Decimal10f
can have,
922337203.6854775807.public static final Decimal10f MAX_INTEGER_VALUE
Decimal10f
can have, 922337203.0000000000.public static final Decimal10f MIN_VALUE
Decimal10f
can have,
-922337203.6854775808.public static final Decimal10f MIN_INTEGER_VALUE
Decimal10f
can have, -922337203.0000000000.public Decimal10f(String value)
Decimal
into a
Decimal10f
. The string representation consists of an
optional sign, '+'
or '-'
, followed by a sequence of
zero or more decimal digits ("the integer"), optionally followed by a
fraction.
The fraction consists of a decimal point followed by zero or more decimal
digits. The string must contain at least one digit in either the integer
or the fraction. If the fraction contains more than 10 digits, the
value is rounded using HALF_UP
rounding. An
exception is thrown if the value is too large to be represented as a
Decimal10f
.
value
- String value to convert into a Decimal10f
NumberFormatException
- if value
does not represent a valid Decimal
or if the value is too large to be represented as a
Decimal10f
public final Scale10f getScaleMetrics()
Decimal
long
value underlying this Decimal
.ScaleMetrics.getScale()
,
ScaleMetrics.getScaleFactor()
public final int getScale()
Decimal
long
value underlying this Decimal
.
If the scale is f
then the value represented by a Decimal
instance is
(unscaledValue × 10-f).
This method is a shortcut for getScaleMetrics().getScale()
.
Decimal.getScaleMetrics()
,
ScaleMetrics.getScale()
,
Decimal.unscaledValue()
public final Factory10f getFactory()
Decimal
this
Decimal.protected final Decimal10f self()
AbstractDecimal
this
decimal value as concrete implementation subtype.self
in class AbstractDecimal<Scale10f,Decimal10f>
this
protected final DecimalArithmetic getDefaultArithmetic()
AbstractDecimal
HALF_UP
.getDefaultArithmetic
in class AbstractDecimal<Scale10f,Decimal10f>
HALF_UP
rounding and UNCHECKED
overflow
modeprotected final DecimalArithmetic getDefaultCheckedArithmetic()
AbstractDecimal
HALF_UP
.getDefaultCheckedArithmetic
in class AbstractDecimal<Scale10f,Decimal10f>
HALF_UP
rounding and CHECKED
overflow modeprotected final DecimalArithmetic getRoundingDownArithmetic()
AbstractDecimal
DOWN
.getRoundingDownArithmetic
in class AbstractDecimal<Scale10f,Decimal10f>
DOWN
rounding and
UNCHECKED
overflow modeprotected final DecimalArithmetic getRoundingFloorArithmetic()
AbstractDecimal
FLOOR
.getRoundingFloorArithmetic
in class AbstractDecimal<Scale10f,Decimal10f>
FLOOR
rounding and
UNCHECKED
overflow modeprotected final DecimalArithmetic getRoundingHalfEvenArithmetic()
AbstractDecimal
HALF_EVEN
.getRoundingHalfEvenArithmetic
in class AbstractDecimal<Scale10f,Decimal10f>
HALF_UP
rounding and
UNCHECKED
overflow modeprotected final DecimalArithmetic getRoundingUnnecessaryArithmetic()
AbstractDecimal
UNNECESSARY
.getRoundingUnnecessaryArithmetic
in class AbstractDecimal<Scale10f,Decimal10f>
UNNECESSARY
rounding and UNCHECKED
overflow
modepublic static Decimal10f valueOf(long value)
Decimal10f
whose value is numerically equal to
that of the specified long
value. An exception is thrown if the
specified value is too large to be represented as a Decimal10f
.value
- long value to convert into a Decimal10f
Decimal10f
value numerically equal to the specified
long
valueIllegalArgumentException
- if value
is too large to be represented as a
Decimal10f
public static Decimal10f valueOf(float value)
Decimal10f
whose value is calculated by
rounding the specified float
argument to scale 10
using HALF_UP
rounding. An exception is thrown
if the specified value is too large to be represented as a Decimal10f
.value
- float value to convert into a Decimal10f
Decimal10f
calculated as: roundHALF_UP(value)IllegalArgumentException
- if value
is NaN or infinite or if the magnitude is
too large for the float to be represented as a Decimal10f
public static Decimal10f valueOf(float value, RoundingMode roundingMode)
Decimal10f
whose value is calculated by
rounding the specified float
argument to scale 10
using the specified roundingMode
. An exception is thrown
if the specified value is too large to be represented as a Decimal10f
.value
- float value to convert into a Decimal10f
roundingMode
- the rounding mode to apply during the conversion if necessaryDecimal10f
calculated as: round(value)IllegalArgumentException
- if value
is NaN or infinite or if the magnitude is
too large for the float to be represented as a Decimal10f
ArithmeticException
- if roundingMode==UNNECESSARY
and rounding is
necessarypublic static Decimal10f valueOf(double value)
Decimal10f
whose value is calculated by
rounding the specified double
argument to scale 10
using HALF_UP
rounding. An exception is thrown
if the specified value is too large to be represented as a Decimal10f
.value
- double value to convert into a Decimal10f
Decimal10f
calculated as: roundHALF_UP(value)IllegalArgumentException
- if value
is NaN or infinite or if the magnitude is
too large for the double to be represented as a Decimal10f
public static Decimal10f valueOf(double value, RoundingMode roundingMode)
Decimal10f
whose value is calculated by
rounding the specified double
argument to scale 10
using the specified roundingMode
. An exception is thrown
if the specified value is too large to be represented as a Decimal10f
.value
- double value to convert into a Decimal10f
roundingMode
- the rounding mode to apply during the conversion if necessaryDecimal10f
calculated as: round(value)IllegalArgumentException
- if value
is NaN or infinite or if the magnitude is
too large for the double to be represented as a Decimal10f
ArithmeticException
- if roundingMode==UNNECESSARY
and rounding is
necessarypublic static Decimal10f valueOf(BigInteger value)
Decimal10f
whose value is numerically equal to that of
the specified BigInteger
value. An exception is thrown if the
specified value is too large to be represented as a Decimal10f
.value
- BigInteger
value to convert into a Decimal10f
Decimal10f
value numerically equal to the specified big
integer valueIllegalArgumentException
- if value
is too large to be represented as a Decimal10f
public static Decimal10f valueOf(BigDecimal value)
Decimal10f
whose value is calculated by rounding
the specified BigDecimal
argument to scale 10 using
HALF_UP
rounding. An exception is thrown if the
specified value is too large to be represented as a Decimal10f
.value
- BigDecimal
value to convert into a Decimal10f
Decimal10f
calculated as: roundHALF_UP(value)IllegalArgumentException
- if value
is too large to be represented as a Decimal10f
public static Decimal10f valueOf(BigDecimal value, RoundingMode roundingMode)
Decimal10f
whose value is calculated by rounding
the specified BigDecimal
argument to scale 10 using
the specified roundingMode
. An exception is thrown if the
specified value is too large to be represented as a Decimal10f
.value
- BigDecimal
value to convert into a Decimal10f
roundingMode
- the rounding mode to apply during the conversion if necessaryDecimal10f
calculated as: round(value)IllegalArgumentException
- if value
is too large to be represented as a Decimal10f
ArithmeticException
- if roundingMode==UNNECESSARY
and rounding is
necessarypublic static Decimal10f valueOf(Decimal<?> value)
Decimal10f
whose value is calculated by rounding
the specified Decimal
argument to scale 10 using
HALF_UP
rounding. An exception is thrown if the
specified value is too large to be represented as a Decimal10f
.value
- Decimal value to convert into a Decimal10f
Decimal10f
calculated as: roundHALF_UP(value)IllegalArgumentException
- if value
is too large to be represented as a Decimal10f
public static Decimal10f valueOf(Decimal<?> value, RoundingMode roundingMode)
Decimal10f
whose value is calculated by rounding
the specified Decimal
argument to scale 10 using
the specified roundingMode
. An exception is thrown if the
specified value is too large to be represented as a Decimal10f
.value
- Decimal value to convert into a Decimal10f
roundingMode
- the rounding mode to apply during the conversion if necessaryDecimal10f
calculated as: round(value)IllegalArgumentException
- if value
is too large to be represented as a Decimal10f
ArithmeticException
- if roundingMode==UNNECESSARY
and rounding is
necessarypublic static Decimal10f valueOf(String value)
Decimal
into a
Decimal10f
. The string representation consists of an
optional sign, '+'
or '-'
, followed by a sequence of
zero or more decimal digits ("the integer"), optionally followed by a
fraction.
The fraction consists of a decimal point followed by zero or more decimal
digits. The string must contain at least one digit in either the integer
or the fraction. If the fraction contains more than 10 digits, the
value is rounded using HALF_UP
rounding. An
exception is thrown if the value is too large to be represented as a
Decimal10f
.
value
- String value to convert into a Decimal10f
Decimal10f
calculated as: roundHALF_UP(value)NumberFormatException
- if value
does not represent a valid Decimal
or if the value is too large to be represented as a
Decimal10f
public static Decimal10f valueOf(String value, RoundingMode roundingMode)
Decimal
into a
Decimal10f
. The string representation consists of an
optional sign, '+'
or '-'
, followed by a sequence of
zero or more decimal digits ("the integer"), optionally followed by a
fraction.
The fraction consists of a decimal point followed by zero or more decimal
digits. The string must contain at least one digit in either the integer
or the fraction. If the fraction contains more than 10 digits, the
value is rounded using the specified roundingMode
. An exception
is thrown if the value is too large to be represented as a Decimal10f
.
value
- String value to convert into a Decimal10f
roundingMode
- the rounding mode to apply if the fraction contains more than
10 digitsDecimal10f
calculated as: round(value)NumberFormatException
- if value
does not represent a valid Decimal
or if the value is too large to be represented as a
Decimal10f
ArithmeticException
- if roundingMode==UNNECESSARY
and rounding is
necessarypublic static Decimal10f valueOfUnscaled(long unscaledValue)
Decimal10f
whose value is numerically equal to
(unscaledValue × 10-10).unscaledValue
- unscaled value to convert into a Decimal10f
Decimal10f
calculated as:
unscaledValue × 10-10public static Decimal10f valueOfUnscaled(long unscaledValue, int scale)
Decimal10f
whose value is numerically equal to
(unscaledValue × 10-scale). The result is
rounded to scale 10 using HALF_UP
rounding. An exception is thrown if the specified value is too large
to be represented as a Decimal10f
.unscaledValue
- unscaled value to convert into a Decimal10f
scale
- the scale to apply to unscaledValue
Decimal10f
calculated as:
roundHALF_UP(unscaledValue × 10-scale)IllegalArgumentException
- if the specified value is too large to be represented as a
Decimal10f
public static Decimal10f valueOfUnscaled(long unscaledValue, int scale, RoundingMode roundingMode)
Decimal10f
whose value is numerically equal to
(unscaledValue × 10-scale). The result
is rounded to scale 10 using the specified roundingMode
.
An exception is thrown if the specified value is too large to be
represented as a Decimal10f
.unscaledValue
- unscaled value to convert into a Decimal10scale
- the scale to apply to unscaledValue
roundingMode
- the rounding mode to apply during the conversion if necessaryDecimal10f
calculated as:
round(unscaledValue × 10-scale)IllegalArgumentException
- if the specified value is too large to be represented as a Decimal10f
protected Decimal10f createOrAssign(long unscaled)
AbstractDecimal
Decimal
whose value is
(unscaled × 10-scale).
The returned value is a new instance if this decimal is an
ImmutableDecimal
. If it is a MutableDecimal
then its
internal state is altered and this
is returned as result now
representing (unscaled × 10-scale).
createOrAssign
in class AbstractDecimal<Scale10f,Decimal10f>
unscaled
- unscaled value to be returned as a Decimal
protected Decimal10f create(long unscaled)
AbstractDecimal
Decimal
whose value is
(unscaled × 10-scale).create
in class AbstractDecimal<Scale10f,Decimal10f>
unscaled
- unscaled value to be returned as a Decimal
protected Decimal10f[] createArray(int length)
AbstractDecimal
Decimal
array of the specified length
.createArray
in class AbstractDecimal<Scale10f,Decimal10f>
length
- the length of the array to returnnew D[length]
public Multipliable10f multiplyExact()
Decimal
as a multipliable factor for typed
exact multiplication. The second factor is passed to one of the
by(..)
methods of the returned multiplier. The scale of
the result is the sum of the scales of this
Decimal and the
second factor passed to the by(..)
method.
The method is similar to multiplyExact(Decimal)
but the result
is retrieved in exact typed form with the correct result scale.
For instance one can write:
Decimal12f product = this.multiplyExact().by(Decimal2f.FIVE);
public MutableDecimal10f toMutableDecimal()
Decimal
Decimal
value is already a MutableDecimal
it is simply returned. Otherwise a new mutable
value with the same scale and numerical value as this
Decimal is created and returned.this
if mutable and a new MutableDecimal
with the same scale and value as this
Decimal otherwisepublic Decimal10f toImmutableDecimal()
Decimal
Decimal
value is already an ImmutableDecimal
it is simply returned. Otherwise a new
immutable value with the same scale and numerical value as this
Decimal is created and returned.this
if immutable and a new ImmutableDecimal
with the same scale and value as
this
Decimal otherwise