public class StandardDecimaliser extends Object implements Decimaliser
Decimaliser that converts floating-point numbers to their decimal representation in
standard form. This class ensures that large numbers are represented in full, while small values are rounded
to a maximum of 18 decimal places.
Note: The conversion process first tries to utilize the MaximumPrecision with a precision of 18,
and if unsuccessful, falls back to a UsesBigDecimal strategy.
| Modifier and Type | Field and Description |
|---|---|
static StandardDecimaliser |
STANDARD
Singleton instance of StandardDecimaliser.
|
| Constructor and Description |
|---|
StandardDecimaliser() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
toDecimal(double value,
DecimalAppender decimalAppender)
Converts a double value to its decimal representation in standard form and appends it using the provided
DecimalAppender. |
boolean |
toDecimal(float value,
DecimalAppender decimalAppender)
Converts a float value to its decimal representation in standard form and appends it using the provided
DecimalAppender. |
public static final StandardDecimaliser STANDARD
public boolean toDecimal(double value,
DecimalAppender decimalAppender)
DecimalAppender. The conversion process will round small values to a maximum of 18 decimal places,
while large numbers will be represented in full.toDecimal in interface Decimaliservalue - the double value to be converted.decimalAppender - the DecimalAppender used to store and append the converted decimal value.public boolean toDecimal(float value,
DecimalAppender decimalAppender)
DecimalAppender. The conversion process will round small values to a maximum of 18 decimal places,
while large numbers will be represented in full.toDecimal in interface Decimaliservalue - the float value to be converted.decimalAppender - the DecimalAppender used to store and append the converted decimal value.Copyright © 2023. All rights reserved.