public final class Decimal128 extends Number implements Comparable<Decimal128>
A 128-bit fixed-length Decimal value in the ANSI SQL Numeric semantics, representing unscaledValue / 10**scale where scale is 0 or positive.
This class is similar to BigDecimal
, but a few things
differ to conform to the SQL Numeric semantics.
Scale of this object is specified by the user, not automatically determined
like BigDecimal
. This means that underflow is possible
depending on the scale. BigDecimal
controls rounding
behaviors by MathContext, possibly throwing errors. But, underflow is NOT an
error in ANSI SQL Numeric. "CAST(0.000000000....0001 AS DECIMAL(38,1))" is
"0.0" without an error.
Because this object is fixed-length, overflow is also possible. Overflow IS an error in ANSI SQL Numeric. "CAST(10000 AS DECIMAL(38,38))" throws overflow error.
Each arithmetic operator takes scale as a parameter to control its behavior. It's user's (or query optimizer's) responsibility to give an appropriate scale parameter.
Finally, this class performs MUCH faster than java.math.BigDecimal for a few
reasons. Its behavior is simple because of the designs above. This class is
fixed-length without array expansion and re-allocation. This class is
mutable, allowing reuse of the same object without re-allocation. This class
and UnsignedInt128
are designed such that minimal heap-object
allocations are required for most operations. The only exception is division.
Even this class requires a few object allocations for division, though much
fewer than BigDecimal.
Modifier and Type | Field and Description |
---|---|
static short |
MAX_SCALE
Maximum value for #scale.
|
static Decimal128 |
MAX_VALUE
Maximum value that can be represented in this class.
|
static short |
MIN_SCALE
Minimum value for #scale.
|
static Decimal128 |
MIN_VALUE
Minimum value that can be represented in this class.
|
static Decimal128 |
ONE |
Constructor and Description |
---|
Decimal128()
Construct a zero.
|
Decimal128(char[] str,
int offset,
int length,
short scale)
Constructs from the given string with given offset and length.
|
Decimal128(Decimal128 o)
Copy constructor.
|
Decimal128(double val,
short scale)
Translates a
double into a Decimal128 in the given scaling. |
Decimal128(long val)
Translates a
long into a Decimal128 . |
Decimal128(long val,
short scale)
Translates a
long into a Decimal128 with the given scaling. |
Decimal128(String str,
short scale)
Constructs from the given string.
|
Decimal128(UnsignedInt128 unscaledVal,
short scale,
boolean negative)
Translates a
UnsignedInt128 unscaled value, an int scale,
and sign flag into a Decimal128 . |
Modifier and Type | Method and Description |
---|---|
void |
absDestructive()
Makes this
Decimal128 a positive number. |
static void |
add(Decimal128 left,
Decimal128 right,
Decimal128 result,
short scale)
Calculates addition and puts the result into the given object.
|
Decimal128 |
addDestructive(Decimal128 right,
short scale)
Calculates addition and stores the result into this object.
|
void |
changeScaleDestructive(short scale)
Changes the scaling of this
Decimal128 , preserving the represented
value. |
void |
checkPrecisionOverflow(int precision)
Throws an exception if the value of this object exceeds the maximum value
for the given precision.
|
int |
compareTo(Decimal128 val)
Compares this
Decimal128 with the specified Decimal128 . |
static void |
divide(Decimal128 left,
Decimal128 right,
Decimal128 quotient,
short scale)
Performs division and puts the result into the given object.
|
void |
divideDestructive(Decimal128 right,
short newScale)
Divide the target object by right, and scale the result to newScale.
|
void |
divideDestructiveNativeDecimal128(Decimal128 right,
short newScale,
Decimal128 remainder)
As of 1/20/2014 this has a known bug in division.
|
double |
doubleValue()
Converts this
Decimal128 to a double . |
boolean |
equals(Object x)
Compares this
Decimal128 with the specified Object for
equality. |
int |
fastSerializeForHiveDecimal(Decimal128FastBuffer scratch)
Serializes the value in a format compatible with the BigDecimal's own representation
|
Decimal128 |
fastUpdateFromInternalStorage(byte[] internalStorage,
short scale)
Fats update from BigInteger two's complement representation
|
float |
floatValue()
Converts this
Decimal128 to a float . |
String |
getHiveDecimalString()
Returns the string representation of this value.
|
static int |
getIntsPerElement(int precision)
Determines the number of ints to store one value.
|
short |
getScale()
Returns the scale of this
Decimal128 . |
byte |
getSignum()
Returns the signum of this
Decimal128 . |
UnsignedInt128 |
getUnscaledValue()
Returns unscaled value of this
Decimal128 . |
int |
hashCode()
Returns the hash code for this
Decimal128 . |
int |
intValue()
Converts this
Decimal128 to an int . |
boolean |
isZero() |
long |
longValue()
Converts this
Decimal128 to a long . |
static void |
modulo(Decimal128 left,
Decimal128 right,
Decimal128 result,
short scale)
Performs decimal modulo
|
static void |
multiply(Decimal128 left,
Decimal128 right,
Decimal128 result,
short scale)
Calculates multiplication and puts the result into the given object.
|
void |
multiplyDestructive(Decimal128 right,
short newScale)
Performs multiplication, changing the scale of this object to the specified
value.
|
void |
multiplyDestructiveNativeDecimal128(Decimal128 right,
short newScale)
As of 2/11/2014 this has a known bug in multiplication.
|
void |
negateDestructive()
Reverses the sign of this
Decimal128 . |
double |
powAsDouble(double n)
Calculate the power of this value in double precision.
|
void |
serializeTo(int[] array,
int offset,
int precision)
Serialize this object to the given array, putting the required number of
ints for the given precision.
|
void |
serializeTo(IntBuffer buf,
int precision)
Serialize this object to the given ByteBuffer, putting the required number
of ints for the given precision.
|
void |
serializeTo128(int[] array,
int offset)
Serialize this object to the given integers, putting 128+32 bits of data
(full range).
|
void |
serializeTo128(IntBuffer buf)
Serialize this object to the given ByteBuffer, putting 128+32 bits of data
(full range).
|
void |
serializeTo32(int[] array,
int offset)
Serialize this object to the given integers, putting only 32+32 bits of
data.
|
void |
serializeTo32(IntBuffer buf)
Serialize this object to the given ByteBuffer, putting only 32+32 bits of
data.
|
void |
serializeTo64(int[] array,
int offset)
Serialize this object to the given integers, putting only 64+32 bits of
data.
|
void |
serializeTo64(IntBuffer buf)
Serialize this object to the given ByteBuffer, putting only 64+32 bits of
data.
|
void |
serializeTo96(int[] array,
int offset)
Serialize this object to the given integers, putting only 96+32 bits of
data.
|
void |
serializeTo96(IntBuffer buf)
Serialize this object to the given ByteBuffer, putting only 96+32 bits of
data.
|
void |
setNullDataValue()
Vectorized execution uses the smallest possible positive non-zero
value to prevent possible later zero-divide exceptions.
|
void |
setScale(short scale)
This setter is only for de-serialization, should not be used otherwise.
|
void |
setSignum(byte signum)
This setter is only for de-serialization, should not be used otherwise.
|
void |
setUnscaledValue(UnsignedInt128 unscaledValue)
This setter is only for de-serialization, should not be used otherwise.
|
double |
sqrtAsDouble()
Calculate the square root of this value in double precision.
|
Decimal128 |
squareDestructive()
Multiplies this with this, updating this
|
static void |
subtract(Decimal128 left,
Decimal128 right,
Decimal128 result,
short scale)
Calculates subtraction and puts the result into the given object.
|
Decimal128 |
subtractDestructive(Decimal128 right,
short scale)
Calculates subtraction and stores the result into this object.
|
BigDecimal |
toBigDecimal()
Converts this object to
BigDecimal . |
String |
toFormalString()
Returns the formal string representation of this value.
|
String |
toString() |
Decimal128 |
update(BigDecimal bigDecimal)
Updates the value of this object with the given
BigDecimal . |
Decimal128 |
update(BigInteger bigInt,
short scale)
Updates the value of this object with the given
BigInteger and scale. |
Decimal128 |
update(char[] str,
int offset,
int length,
short scale)
Updates the value of this object from the given string with given offset
and length.
|
Decimal128 |
update(Decimal128 o)
Copy the value of given object.
|
Decimal128 |
update(Decimal128 o,
short scale)
Copy the value of given object and assigns a custom scale.
|
Decimal128 |
update(double val,
short scale)
Update the value of this object with the given
double . |
Decimal128 |
update(int[] array,
int offset,
int precision)
Updates the value of this object by reading from the given array, using the
required number of ints for the given precision.
|
Decimal128 |
update(IntBuffer buf,
int precision)
Updates the value of this object by reading from ByteBuffer, using the
required number of ints for the given precision.
|
Decimal128 |
update(long val)
Update the value of this object with the given
long . |
Decimal128 |
update(long val,
short scale)
Update the value of this object with the given
long with the given
scal. |
Decimal128 |
update(String str,
short scale)
Updates the value of this object with the given string.
|
Decimal128 |
update128(int[] array,
int offset)
Updates the value of this object by reading from the given integers,
receiving 128+32 bits of data (full range).
|
Decimal128 |
update128(IntBuffer buf)
Updates the value of this object by reading from ByteBuffer, receiving
128+32 bits data (full ranges).
|
Decimal128 |
update32(int[] array,
int offset)
Updates the value of this object by reading from the given integers,
receiving only 32+32 bits data.
|
Decimal128 |
update32(IntBuffer buf)
Updates the value of this object by reading from ByteBuffer, receiving only
32+32 bits data.
|
Decimal128 |
update64(int[] array,
int offset)
Updates the value of this object by reading from the given integers,
receiving only 64+32 bits data.
|
Decimal128 |
update64(IntBuffer buf)
Updates the value of this object by reading from ByteBuffer, receiving only
64+32 bits data.
|
Decimal128 |
update96(int[] array,
int offset)
Updates the value of this object by reading from the given integers,
receiving only 96+32 bits data.
|
Decimal128 |
update96(IntBuffer buf)
Updates the value of this object by reading from ByteBuffer, receiving only
96+32 bits data.
|
void |
updateFixedPoint(long val,
short scale)
Update the value to a decimal value with the decimal point equal to
val but with the decimal point inserted scale
digits from the right.
|
Decimal128 |
updateVarianceDestructive(Decimal128 scratch,
Decimal128 value,
Decimal128 sum,
long count)
For UDAF variance we use the algorithm described by Chan, Golub, and LeVeque in
"Algorithms for computing the sample variance: analysis and recommendations"
The American Statistician, 37 (1983) pp.
|
Decimal128 |
zeroClear()
Reset the value of this object to zero.
|
void |
zeroFractionPart() |
void |
zeroFractionPart(UnsignedInt128 scratch)
Zero the fractional part of value.
|
byteValue, shortValue
public static final short MAX_SCALE
public static final short MIN_SCALE
public static final Decimal128 ONE
public static final Decimal128 MAX_VALUE
public static final Decimal128 MIN_VALUE
public Decimal128()
public Decimal128(Decimal128 o)
o
- object to copy frompublic Decimal128(double val, short scale)
double
into a Decimal128
in the given scaling.
Note that, unlike java.math.BigDecimal, the scaling is given as the
parameter, not automatically detected. This is one of the differences
between ANSI SQL Numeric and Java's BigDecimal. See class comments for more
details.
Unchecked exceptions: ArithmeticException if val
overflows in the
scaling. NumberFormatException if val
is infinite or NaN.
val
- double
value to be converted to Decimal128
.scale
- scale of the Decimal128
.public Decimal128(UnsignedInt128 unscaledVal, short scale, boolean negative)
UnsignedInt128
unscaled value, an int
scale,
and sign flag into a Decimal128
. The value of the
Decimal128
is (unscaledVal × 10-scale).unscaledVal
- unscaled value of the Decimal128
.scale
- scale of the Decimal128
.negative
- whether the value is negativepublic Decimal128(long val)
long
into a Decimal128
. The scale of the
Decimal128
is zero.val
- long
value to be converted to Decimal128
.public Decimal128(long val, short scale)
long
into a Decimal128
with the given scaling.val
- long
value to be converted to Decimal128
.scale
- scale of the Decimal128
.public Decimal128(String str, short scale)
str
- stringscale
- scale of the Decimal128
.public Decimal128(char[] str, int offset, int length, short scale)
str
- stringoffset
- offsetlength
- lengthscale
- scale of the Decimal128
.public static int getIntsPerElement(int precision)
precision
- precision (0-38)public Decimal128 zeroClear()
public boolean isZero()
public Decimal128 update(Decimal128 o)
o
- object to copy frompublic Decimal128 update(Decimal128 o, short scale)
o
- object to copy frompublic Decimal128 update(long val)
long
. The scale of
the Decimal128
is zero.val
- long
value to be set to Decimal128
.public Decimal128 update(long val, short scale)
long
with the given
scal.val
- long
value to be set to Decimal128
.scale
- scale of the Decimal128
.public Decimal128 update(double val, short scale)
double
. in the given
scaling. Note that, unlike java.math.BigDecimal, the scaling is given as
the parameter, not automatically detected. This is one of the differences
between ANSI SQL Numeric and Java's BigDecimal. See class comments for more
details.
Unchecked exceptions: ArithmeticException if val
overflows in the
scaling. NumberFormatException if val
is infinite or NaN.
val
- double
value to be converted to Decimal128
.scale
- scale of the Decimal128
.public Decimal128 update(IntBuffer buf, int precision)
buf
- ByteBuffer to read values fromprecision
- 0 to 38. Decimal digits.public Decimal128 update128(IntBuffer buf)
buf
- ByteBuffer to read values frompublic Decimal128 update96(IntBuffer buf)
buf
- ByteBuffer to read values frompublic Decimal128 update64(IntBuffer buf)
buf
- ByteBuffer to read values frompublic Decimal128 update32(IntBuffer buf)
buf
- ByteBuffer to read values frompublic Decimal128 update(int[] array, int offset, int precision)
array
- array to read values fromoffset
- offset of the long arrayprecision
- 0 to 38. Decimal digits.public Decimal128 update128(int[] array, int offset)
array
- array to read fromoffset
- offset of the int arraypublic Decimal128 update96(int[] array, int offset)
array
- array to read fromoffset
- offset of the int arraypublic Decimal128 update64(int[] array, int offset)
array
- array to read fromoffset
- offset of the int arraypublic Decimal128 update32(int[] array, int offset)
array
- array to read fromoffset
- offset of the int arraypublic Decimal128 update(BigDecimal bigDecimal)
BigDecimal
.bigDecimal
- BigDecimal
public Decimal128 update(BigInteger bigInt, short scale)
BigInteger
and scale.bigInt
- BigInteger
scale
- public Decimal128 update(String str, short scale)
str
- stringscale
- scale of the Decimal128
.public Decimal128 update(char[] str, int offset, int length, short scale)
str
- stringoffset
- offsetlength
- lengthscale
- scale of the Decimal128
.public int fastSerializeForHiveDecimal(Decimal128FastBuffer scratch)
scratch
- public void serializeTo(int[] array, int offset, int precision)
array
- array to write values tooffset
- offset of the int arrayprecision
- 0 to 38. Decimal digits.public void serializeTo128(int[] array, int offset)
array
- array to write values tooffset
- offset of the int arraypublic void serializeTo96(int[] array, int offset)
array
- array to write values tooffset
- offset of the int arraypublic void serializeTo64(int[] array, int offset)
array
- array to write values tooffset
- offset of the int arraypublic void serializeTo32(int[] array, int offset)
array
- array to write values tooffset
- offset of the int arraypublic void serializeTo(IntBuffer buf, int precision)
buf
- ByteBuffer to write values toprecision
- 0 to 38. Decimal digits.public void serializeTo128(IntBuffer buf)
buf
- ByteBuffer to write values topublic void serializeTo96(IntBuffer buf)
buf
- ByteBuffer to write values topublic void serializeTo64(IntBuffer buf)
buf
- ByteBuffer to write values topublic void serializeTo32(IntBuffer buf)
buf
- ByteBuffer to write values topublic void changeScaleDestructive(short scale)
Decimal128
, preserving the represented
value. This method is destructive.
This method is NOT just a setter for #scale. It also adjusts the unscaled value to preserve the represented value.
When the given scaling is larger than the current scaling, this method shrinks the unscaled value accordingly. It will NOT throw any error even if underflow happens.
When the given scaling is smaller than the current scaling, this method expands the unscaled value accordingly. It does throw an error if overflow happens.
Unchecked exceptions: ArithmeticException a negative value is specified or overflow.
scale
- new scale. must be 0 or positive.public static void add(Decimal128 left, Decimal128 right, Decimal128 result, short scale)
Unchecked exceptions: ArithmeticException an invalid scale is specified or overflow.
left
- left operandright
- right operandscale
- scale of the result. must be 0 or positive.result
- object to receive the calculation resultpublic Decimal128 addDestructive(Decimal128 right, short scale)
Unchecked exceptions: ArithmeticException an invalid scale is specified or overflow.
right
- right operandscale
- scale of the result. must be 0 or positive.public static void subtract(Decimal128 left, Decimal128 right, Decimal128 result, short scale)
Unchecked exceptions: ArithmeticException an invalid scale is specified or overflow.
left
- left operandright
- right operandresult
- object to receive the calculation resultscale
- scale of the result. must be 0 or positive.public Decimal128 subtractDestructive(Decimal128 right, short scale)
Unchecked exceptions: ArithmeticException an invalid scale is specified or overflow.
right
- right operandscale
- scale of the result. must be 0 or positive.public static void multiply(Decimal128 left, Decimal128 right, Decimal128 result, short scale)
Unchecked exceptions: ArithmeticException an invalid scale is specified or overflow.
left
- left operandright
- right operandresult
- object to receive the calculation resultscale
- scale of the result. must be 0 or positive.public void multiplyDestructiveNativeDecimal128(Decimal128 right, short newScale)
right
- right operand. this object is not modified.newScale
- scale of the result. must be 0 or positive.public void multiplyDestructive(Decimal128 right, short newScale)
right
- right operand. this object is not modified.newScale
- scale of the result. must be 0 or positive.public static void divide(Decimal128 left, Decimal128 right, Decimal128 quotient, short scale)
Unchecked exceptions: ArithmeticException an invalid scale is specified or overflow.
left
- left operandright
- right operandquotient
- result object to receive the calculation resultscale
- scale of the result. must be 0 or positive.public void divideDestructiveNativeDecimal128(Decimal128 right, short newScale, Decimal128 remainder)
Unchecked exceptions: ArithmeticException an invalid scale is specified or overflow.
right
- right operand. this object is not modified.newScale
- scale of the result. must be 0 or positive.remainder
- object to receive remainderpublic void divideDestructive(Decimal128 right, short newScale)
public static void modulo(Decimal128 left, Decimal128 right, Decimal128 result, short scale)
The definition of modulo (x % p) is: x - IntegerPart(x / p, resultScale) * p
public void absDestructive()
Decimal128
a positive number. Unlike
java.math.BigDecimal, this method is destructive.public void negateDestructive()
Decimal128
. Unlike java.math.BigDecimal,
this method is destructive.public double sqrtAsDouble()
Note that this does NOT perform the calculation in infinite accuracy. Although this sounds weird, it's at least how SQLServer does it. The SQL below demonstrates that SQLServer actually converts it into FLOAT (Java's double).
create table bb (col1 DECIMAL(38,36), col2 DECIMAL (38,36));
insert into bb values(1.00435134913958923485982394892384,1.00345982739817298323423423);
select sqrt(col1) as cola,sqrt(col2) colb into asdasd from bb;
sp_columns asdasd;
This SQL tells that the result is in FLOAT data type. One justification is that, because DECIMAL is at most 38 digits, double precision is enough for sqrt/pow.
This method does not modify this object.
This method throws exception if this value is negative rather than returning NaN. This is the SQL semantics (at least in SQLServer).
public double powAsDouble(double n)
Calculate the power of this value in double precision. Note that this does NOT perform the calculation in infinite accuracy. Although this sounds weird, it's at least how SQLServer does it. The SQL below demonstrates that SQLServer actually converts it into FLOAT (Java's double).
create table bb (col1 DECIMAL(38,36), col2 DECIMAL (38,36));
insert into bb values(1.00435134913958923485982394892384,1.00345982739817298323423423);
select power(col1, col2);
This SQL returns '1.004366436877081000000000000000000000', which is merely a power calculated in double precision ( "java.lang.Math.pow(1.00435134913958923485982394892384d, 1.00345982739817298323423423d)" returns 1.0043664368770813), and then scaled into DECIMAL. The same thing happens even when "n" is a positive integer. One justification is that, because DECIMAL is at most 38 digits, double precision is enough for sqrt/pow.
This method does not modify this object.
This method throws exception if the calculated value is Infinite. This is the SQL semantics (at least in SQLServer).
n
- power to raise this object. Unlike
BigDecimal.pow(int)
, this can receive a
fractional number. Instead, this method calculates the value in
double precision.public byte getSignum()
Decimal128
.Decimal128
is negative,
zero, or positive.public short getScale()
Decimal128
. The scale is the
positive number of digits to the right of the decimal point.Decimal128
.public UnsignedInt128 getUnscaledValue()
Decimal128
. Be careful because
changes on the returned object will affect the object. It is not
recommended to modify the object this method returns.Decimal128
.public int compareTo(Decimal128 val)
Decimal128
with the specified Decimal128
. Two
Decimal128
objects that are equal in value but have a different
scale (like 2.0 and 2.00) are considered equal by this method. This method
is provided in preference to individual methods for each of the six boolean
comparison operators (<, ==, >, >=, !=,
<=). The suggested idiom for performing these comparisons is:
(x.compareTo(y)
<op> 0)
, where
<op> is one of the six comparison operators.compareTo
in interface Comparable<Decimal128>
val
- Decimal128
to which this Decimal128
is to be
compared.Decimal128
is numerically less than, equal to, or greater
than val
.public boolean equals(Object x)
Decimal128
with the specified Object
for
equality. Unlike compareTo
, this method
considers two Decimal128
objects equal only if they are equal in
value and scale (thus 2.0 is not equal to 2.00 when compared by this
method). This somewhat confusing behavior is, however, same as
java.math.BigDecimal.equals
in class Object
x
- Object
to which this Decimal128
is to be compared.true
if and only if the specified Object
is a
Decimal128
whose value and scale are equal to this
Decimal128
's.compareTo(Decimal128)
,
hashCode()
public int hashCode()
Decimal128
. Note that two
Decimal128
objects that are numerically equal but differ in scale
(like 2.0 and 2.00) will generally not have the same hash code. This
somewhat confusing behavior is, however, same as java.math.BigDecimal.hashCode
in class Object
Decimal128
.equals(Object)
public long longValue()
Decimal128
to a long
. This conversion is
analogous to the narrowing primitive conversion from double
to short
as defined in section 5.1.3 of The Java™
Language Specification: any fractional part of this
Decimal128
will be discarded, and if the resulting "
UnsignedInt128
" is too big to fit in a long
, only the
low-order 64 bits are returned. Note that this conversion can lose
information about the overall magnitude and precision of this
Decimal128
value.public int intValue()
Decimal128
to an int
. This conversion is
analogous to the narrowing primitive conversion from double
to short
as defined in section 5.1.3 of The Java™
Language Specification: any fractional part of this
Decimal128
will be discarded, and if the resulting "
UnsignedInt128
" is too big to fit in an int
, only the
low-order 32 bits are returned. Note that this conversion can lose
information about the overall magnitude and precision of this
Decimal128
value.public float floatValue()
Decimal128
to a float
. This conversion is
similar to the narrowing primitive conversion from double
to
float
as defined in section 5.1.3 of The Java™ Language
Specification: if this Decimal128
has too great a magnitude
to represent as a float
, it will be converted to
Float.NEGATIVE_INFINITY
or Float.POSITIVE_INFINITY
as
appropriate. Note that even when the return value is finite, this
conversion can lose information about the precision of the
Decimal128
value.floatValue
in class Number
Decimal128
converted to a float
.public double doubleValue()
Decimal128
to a double
. This conversion is
similar to the narrowing primitive conversion from double
to
float
as defined in section 5.1.3 of The Java™ Language
Specification: if this Decimal128
has too great a magnitude
represent as a double
, it will be converted to
Double.NEGATIVE_INFINITY
or Double.POSITIVE_INFINITY
as
appropriate. Note that even when the return value is finite, this
conversion can lose information about the precision of the
Decimal128
value.doubleValue
in class Number
Decimal128
converted to a double
.public BigDecimal toBigDecimal()
BigDecimal
. This method is not supposed to
be used in a performance-sensitive place.BigDecimal
object equivalent to this object.public void checkPrecisionOverflow(int precision)
precision
- maximum precisionpublic String getHiveDecimalString()
public String toFormalString()
toString()
, this method returns a string that
can be used to re-construct this object. Remember, toString() is only for
debugging.public void setNullDataValue()
public void updateFixedPoint(long val, short scale)
public void zeroFractionPart(UnsignedInt128 scratch)
public void zeroFractionPart()
public Decimal128 squareDestructive()
public Decimal128 updateVarianceDestructive(Decimal128 scratch, Decimal128 value, Decimal128 sum, long count)
public Decimal128 fastUpdateFromInternalStorage(byte[] internalStorage, short scale)
internalStorage
- BigInteger two's complement representation of the unscaled valuescale
- public void setUnscaledValue(UnsignedInt128 unscaledValue)
public void setScale(short scale)
public void setSignum(byte signum)
Copyright © 2017 The Apache Software Foundation. All rights reserved.