Class Decimal128
- java.lang.Object
- 
- org.firebirdsql.extern.decimal.Decimal<Decimal128>
- 
- org.firebirdsql.extern.decimal.Decimal128
 
 
- 
 public final class Decimal128 extends Decimal<Decimal128> An IEEE-754 Decimal128.- Author:
- Mark Rotteveel
 
- 
- 
Field SummaryFields Modifier and Type Field Description static Decimal128NEGATIVE_INFINITYstatic Decimal128NEGATIVE_NANstatic Decimal128NEGATIVE_SIGNALING_NANstatic Decimal128POSITIVE_INFINITYstatic Decimal128POSITIVE_NANstatic Decimal128POSITIVE_SIGNALING_NAN
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static Decimal128parseBytes(byte[] decBytes)Parses the provided byte array to aDecimal128.static Decimal128valueOf(double value)Creates aDecimal128fromvalue, applying rounding where necessary.static Decimal128valueOf(double value, OverflowHandling overflowHandling)Creates aDecimal128fromvalue, applying rounding where necessary.static Decimal128valueOf(java.lang.String value)Creates aDecimal128fromvalue, applying rounding where necessary.static Decimal128valueOf(java.lang.String value, OverflowHandling overflowHandling)Creates aDecimal128fromvalue, applying rounding where necessary.static Decimal128valueOf(java.math.BigDecimal value)Creates aDecimal128fromvalue, applying rounding where necessary.static Decimal128valueOf(java.math.BigDecimal value, OverflowHandling overflowHandling)Creates aDecimal128fromvalue, applying rounding where necessary.static Decimal128valueOf(java.math.BigInteger value)Creates aDecimal128fromvalue, applying rounding where necessary.static Decimal128valueOf(java.math.BigInteger value, OverflowHandling overflowHandling)Creates aDecimal128fromvalue, applying rounding where necessary.static Decimal128valueOf(Decimal<?> decimal)Converts a decimal to Decimal128.static Decimal128valueOf(Decimal<?> decimal, OverflowHandling overflowHandling)Converts a decimal to Decimal128.static Decimal128valueOfExact(java.math.BigInteger value)Creates aDecimal128fromvalue, rejecting values that would lose precision due to rounding.- 
Methods inherited from class org.firebirdsql.extern.decimal.DecimaldoubleValue, equals, hashCode, toBigDecimal, toBytes, toDecimal, toDecimal, toString
 
- 
 
- 
- 
- 
Field Detail- 
POSITIVE_INFINITYpublic static final Decimal128 POSITIVE_INFINITY 
 - 
NEGATIVE_INFINITYpublic static final Decimal128 NEGATIVE_INFINITY 
 - 
POSITIVE_NANpublic static final Decimal128 POSITIVE_NAN 
 - 
NEGATIVE_NANpublic static final Decimal128 NEGATIVE_NAN 
 - 
POSITIVE_SIGNALING_NANpublic static final Decimal128 POSITIVE_SIGNALING_NAN 
 - 
NEGATIVE_SIGNALING_NANpublic static final Decimal128 NEGATIVE_SIGNALING_NAN 
 
- 
 - 
Method Detail- 
parseBytespublic static Decimal128 parseBytes(byte[] decBytes) Parses the provided byte array to aDecimal128.This method parses network byte-order (aka big-endian). When using little-endian order, you will need to reverse the bytes in the array first. - Parameters:
- decBytes- Bytes of the Decimal128 value in network byte-order (aka big-endian)
- Returns:
- Instance of Decimal128
- Throws:
- java.lang.IllegalArgumentException- When- decBytesis not 16 bytes long
 
 - 
valueOfpublic static Decimal128 valueOf(java.math.BigDecimal value) Creates aDecimal128fromvalue, applying rounding where necessary.Values exceeding the range of this type will be returned as +/-Infinity. - Parameters:
- value- Big decimal value to convert
- Returns:
- Decimal128 equivalent
 
 - 
valueOfpublic static Decimal128 valueOf(java.math.BigDecimal value, OverflowHandling overflowHandling) Creates aDecimal128fromvalue, applying rounding where necessary.Values exceeding the range of this type will be handled according to the specified overflow handling. - Parameters:
- value- Big decimal value to convert
- overflowHandling- Overflow handling to apply
- Returns:
- Decimal128 equivalent
- Throws:
- DecimalOverflowException- If- OverflowHandling#THROW_EXCEPTIONand the value is out of range.
 
 - 
valueOfpublic static Decimal128 valueOf(java.math.BigInteger value) Creates aDecimal128fromvalue, applying rounding where necessary.Values exceeding the range of this type will be returned as +/-Infinity. - Parameters:
- value- Big integer value to convert
- Returns:
- Decimal128 equivalent
 
 - 
valueOfpublic static Decimal128 valueOf(java.math.BigInteger value, OverflowHandling overflowHandling) Creates aDecimal128fromvalue, applying rounding where necessary.Values exceeding the range of this type will be handled according to the specified overflow handling. Calling this method is equivalent to valueOf(new BigDecimal(value), overflowHandling).- Parameters:
- value- Big integer value to convert
- overflowHandling- Handling of overflows
- Returns:
- Decimal128 equivalent
- Throws:
- DecimalOverflowException- If- OverflowHandling#THROW_EXCEPTIONand the value is out of range.
- See Also:
- valueOfExact(BigInteger)
 
 - 
valueOfExactpublic static Decimal128 valueOfExact(java.math.BigInteger value) Creates aDecimal128fromvalue, rejecting values that would lose precision due to rounding.- Parameters:
- value- Big integer value to convert
- Returns:
- Decimal128 equivalent
- Throws:
- DecimalOverflowException- If the value is out of range.
- See Also:
- valueOf(BigInteger, OverflowHandling)
 
 - 
valueOfpublic static Decimal128 valueOf(double value) Creates aDecimal128fromvalue, applying rounding where necessary.Double.NaNis mapped to positive NaN, the infinities to their equivalent +/- infinity.For normal, finite, values, this is equivalent to valueOf(BigDecimal.valueOf(value)).- Parameters:
- value- Double value
- Returns:
- Decimal equivalent
 
 - 
valueOfpublic static Decimal128 valueOf(double value, OverflowHandling overflowHandling) Creates aDecimal128fromvalue, applying rounding where necessary.Double.NaNis mapped to positive NaN, the infinities to their equivalent +/- infinity.For normal, finite, values, this is equivalent to valueOf(BigDecimal.valueOf(value), overflowHandling).- Parameters:
- value- Double value
- overflowHandling- Overflow handling to apply
- Returns:
- Decimal equivalent
- Throws:
- DecimalOverflowException- If- OverflowHandling#THROW_EXCEPTIONand the value is out of range.
 
 - 
valueOfpublic static Decimal128 valueOf(Decimal<?> decimal) Converts a decimal to Decimal128.For normal, finite, decimals, this behaves like valueOf(decimal.toBigDecimal()), seevalueOf(BigDecimal).- Parameters:
- decimal- Decimal to convert
- Returns:
- Decimal converted to Decimal128, or decimalitself if it already is Decimal128
 
 - 
valueOfpublic static Decimal128 valueOf(Decimal<?> decimal, OverflowHandling overflowHandling) Converts a decimal to Decimal128.For normal, finite, decimals, this behaves like valueOf(decimal.toBigDecimal(), overflowHandling), seevalueOf(BigDecimal, OverflowHandling).- Parameters:
- decimal- Decimal to convert
- overflowHandling- Overflow handling to apply
- Returns:
- Decimal converted to Decimal128, or decimalitself if it already is Decimal128
- Throws:
- DecimalOverflowException- If- OverflowHandling#THROW_EXCEPTIONand the value is out of range.
 
 - 
valueOfpublic static Decimal128 valueOf(java.lang.String value) Creates aDecimal128fromvalue, applying rounding where necessary.Except for the special values [+/-]Inf, [+/-]Infinity, [+/-]NaN and [+/-]sNaN (case insensitive), the rules of BigDecimal(String)apply, with special handling in place to discern between positive and negative zero.Values exceeding the range of this type will be returned as +/-Infinity. - Parameters:
- value- String value to convert
- Returns:
- Decimal equivalent
- Throws:
- java.lang.NumberFormatException- If the provided string is not valid numeric string.
 
 - 
valueOfpublic static Decimal128 valueOf(java.lang.String value, OverflowHandling overflowHandling) Creates aDecimal128fromvalue, applying rounding where necessary.Except for the special values [+/-]Inf, [+/-]Infinity, [+/-]NaN and [+/-]sNaN (case insensitive), the rules of BigDecimal(String)apply, with special handling in place to discern between positive and negative zero.Values exceeding the range of this type will be handled according to the specified overflow handling. - Parameters:
- value- String value to convert
- overflowHandling- Overflow handling to apply
- Returns:
- Decimal equivalent
- Throws:
- java.lang.NumberFormatException- If the provided string is not valid numeric string.
- DecimalOverflowException- If- OverflowHandling#THROW_EXCEPTIONand the value is out of range.
 
 
- 
 
-