public interface Decimaliser
This interface offers multiple strategies for converting floating-point numbers, including a light-weight approach and a more precise, BigDecimal-based implementation.
DecimalAppender
Modifier and Type | Method and Description |
---|---|
boolean |
toDecimal(double value,
DecimalAppender decimalAppender)
Converts a double value to its decimal representation and appends it using the provided DecimalAppender.
|
boolean |
toDecimal(float value,
DecimalAppender decimalAppender)
Converts a float value to its decimal representation and appends it using the provided DecimalAppender.
|
boolean toDecimal(double value, DecimalAppender decimalAppender)
The DecimalAppender should have been implemented to accept the sign, mantissa, and exponent of the decimal representation, and append them accordingly.
value
- 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.boolean toDecimal(float value, DecimalAppender decimalAppender)
The DecimalAppender should have been implemented to accept the sign, mantissa, and exponent of the decimal representation, and append them accordingly.
value
- 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 © 2023. All rights reserved.