public class UsesBigDecimal extends Object implements Decimaliser
BigDecimal for high precision conversions.
Using BigDecimal allocates objects and may be slower than the
lightweight strategies. Reflection is used to access the internal
intCompact field when available; this may break on future JVMs or
under a security manager. The code falls back to BigDecimal.unscaledValue() if reflective access fails.
| Modifier and Type | Field and Description |
|---|---|
static Decimaliser |
USES_BIG_DECIMAL
A singleton instance of
UsesBigDecimal for convenient reuse. |
| Constructor and Description |
|---|
UsesBigDecimal() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
toDecimal(double value,
DecimalAppender decimalAppender)
Converts a double value to its decimal representation using
BigDecimal and appends it
to the provided DecimalAppender. |
boolean |
toDecimal(float value,
DecimalAppender decimalAppender)
Converts a float value to its decimal representation using
BigDecimal and appends it
to the provided DecimalAppender. |
public static final Decimaliser USES_BIG_DECIMAL
UsesBigDecimal for convenient reuse.
This instance is thread-safe and can be used across multiple threads without synchronization.public boolean toDecimal(double value,
DecimalAppender decimalAppender)
BigDecimal and appends it
to the provided DecimalAppender.
If the input is not a finite number or is a negative zero, the conversion will not be performed.
toDecimal in interface Decimaliservalue - The double value to be converted.decimalAppender - The DecimalAppender used to store and append the converted decimal value.true if the conversion and appending were successful, false otherwise.public boolean toDecimal(float value,
DecimalAppender decimalAppender)
BigDecimal and appends it
to the provided DecimalAppender.
If the input is not a finite number, the conversion will not be performed.
toDecimal in interface Decimaliservalue - The float value to be converted.decimalAppender - The DecimalAppender used to store and append the converted decimal value.true if the conversion and appending were successful, false otherwise.Copyright © 2026 Chronicle Software Ltd. All rights reserved.