public final class Decimal32 extends Decimal<Decimal32>
Modifier and Type | Field and Description |
---|---|
static Decimal32 |
NEGATIVE_INFINITY |
static Decimal32 |
NEGATIVE_NAN |
static Decimal32 |
NEGATIVE_SIGNALING_NAN |
static Decimal32 |
POSITIVE_INFINITY |
static Decimal32 |
POSITIVE_NAN |
static Decimal32 |
POSITIVE_SIGNALING_NAN |
Modifier and Type | Method and Description |
---|---|
static Decimal32 |
parseBytes(byte[] decBytes)
Parses the provided byte array to a
Decimal32 . |
static Decimal32 |
valueOf(java.math.BigDecimal value)
Creates a
Decimal32 from value , applying rounding where necessary. |
static Decimal32 |
valueOf(java.math.BigDecimal value,
OverflowHandling overflowHandling)
Creates a
Decimal32 from value , applying rounding where necessary. |
static Decimal32 |
valueOf(java.math.BigInteger value)
Creates a
Decimal32 from value , applying rounding where necessary. |
static Decimal32 |
valueOf(java.math.BigInteger value,
OverflowHandling overflowHandling)
Creates a
Decimal32 from value , applying rounding where necessary. |
static Decimal32 |
valueOf(Decimal<?> decimal)
Converts a decimal to Decimal32.
|
static Decimal32 |
valueOf(Decimal<?> decimal,
OverflowHandling overflowHandling)
Converts a decimal to Decimal32.
|
static Decimal32 |
valueOf(double value)
Creates a
Decimal32 from value , applying rounding where necessary. |
static Decimal32 |
valueOf(double value,
OverflowHandling overflowHandling)
Creates a
Decimal32 from value , applying rounding where necessary. |
static Decimal32 |
valueOf(java.lang.String value)
Creates a
Decimal32 from value , applying rounding where necessary. |
static Decimal32 |
valueOf(java.lang.String value,
OverflowHandling overflowHandling)
Creates a
Decimal32 from value , applying rounding where necessary. |
static Decimal32 |
valueOfExact(java.math.BigInteger value)
Creates a
Decimal32 from value , rejecting values that would lose precision due to rounding. |
doubleValue, equals, hashCode, toBigDecimal, toBytes, toDecimal, toDecimal, toString
public static final Decimal32 POSITIVE_INFINITY
public static final Decimal32 NEGATIVE_INFINITY
public static final Decimal32 POSITIVE_NAN
public static final Decimal32 NEGATIVE_NAN
public static final Decimal32 POSITIVE_SIGNALING_NAN
public static final Decimal32 NEGATIVE_SIGNALING_NAN
public static Decimal32 parseBytes(byte[] decBytes)
Decimal32
.
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.
decBytes
- Bytes of the Decimal32 value in network byte-order (aka big-endian)Decimal32
java.lang.IllegalArgumentException
- When decBytes
is not 4 bytes longpublic static Decimal32 valueOf(java.math.BigDecimal value)
Decimal32
from value
, applying rounding where necessary.
Values exceeding the range of this type will be returned as +/-Infinity.
value
- Big decimal value to convertpublic static Decimal32 valueOf(java.math.BigDecimal value, OverflowHandling overflowHandling)
Decimal32
from value
, applying rounding where necessary.
Values exceeding the range of this type will be handled according to the specified overflow handling.
value
- Big decimal value to convertoverflowHandling
- Overflow handling to applyDecimalOverflowException
- If OverflowHandling#THROW_EXCEPTION
and the value is out of range.public static Decimal32 valueOf(java.math.BigInteger value)
Decimal32
from value
, applying rounding where necessary.
Values exceeding the range of this type will be returned as +/-Infinity.
value
- Big integer value to convertpublic static Decimal32 valueOf(java.math.BigInteger value, OverflowHandling overflowHandling)
Decimal32
from value
, 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)
.
value
- Big integer value to convertoverflowHandling
- Handling of overflowsDecimalOverflowException
- If OverflowHandling#THROW_EXCEPTION
and the value is out of range.valueOfExact(BigInteger)
public static Decimal32 valueOfExact(java.math.BigInteger value)
Decimal32
from value
, rejecting values that would lose precision due to rounding.value
- Big integer value to convertDecimalOverflowException
- If the value is out of range.valueOf(BigInteger, OverflowHandling)
public static Decimal32 valueOf(double value)
Decimal32
from value
, applying rounding where necessary.
Double.NaN
is mapped to positive NaN, the infinities to their equivalent +/- infinity.
For normal, finite, values, this is equivalent to valueOf(BigDecimal.valueOf(value))
.
value
- Double valuepublic static Decimal32 valueOf(double value, OverflowHandling overflowHandling)
Decimal32
from value
, applying rounding where necessary.
Double.NaN
is mapped to positive NaN, the infinities to their equivalent +/- infinity.
For normal, finite, values, this is equivalent to valueOf(BigDecimal.valueOf(value), overflowHandling)
.
value
- Double valueoverflowHandling
- Overflow handling to applyDecimalOverflowException
- If OverflowHandling#THROW_EXCEPTION
and the value is out of range.public static Decimal32 valueOf(Decimal<?> decimal)
For normal, finite, decimals, this behaves like valueOf(decimal.toBigDecimal())
, see
valueOf(BigDecimal)
.
decimal
- Decimal to convertdecimal
itself if it already is Decimal32public static Decimal32 valueOf(Decimal<?> decimal, OverflowHandling overflowHandling)
For normal, finite, decimals, this behaves like valueOf(decimal.toBigDecimal(), overflowHandling)
, see
valueOf(BigDecimal, OverflowHandling)
.
decimal
- Decimal to convertoverflowHandling
- Overflow handling to applydecimal
itself if it already is Decimal32DecimalOverflowException
- If OverflowHandling#THROW_EXCEPTION
and the value is out of range.public static Decimal32 valueOf(java.lang.String value)
Decimal32
from value
, applying rounding where necessary.
Except for the special values [+/-]Inf, [+/-]Infinity, [+/-]NaN and [+/-]sNaN (case insensitive), the rules
of BigDecimal.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.
value
- String value to convertjava.lang.NumberFormatException
- If the provided string is not valid numeric string.public static Decimal32 valueOf(java.lang.String value, OverflowHandling overflowHandling)
Decimal32
from value
, applying rounding where necessary.
Except for the special values [+/-]Inf, [+/-]Infinity, [+/-]NaN and [+/-]sNaN (case insensitive), the rules
of BigDecimal.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.
value
- String value to convertoverflowHandling
- Overflow handling to applyjava.lang.NumberFormatException
- If the provided string is not valid numeric string.DecimalOverflowException
- If OverflowHandling#THROW_EXCEPTION
and the value is out of range.Copyright © 2001-2023 Jaybird (Firebird JDBC/JCA) team. All rights reserved.