public class MaximumPrecision extends Object implements Decimaliser
For example a precision of two converts 1.238 to 1.24.
Trailing zeros introduced by rounding are trimmed.
| Constructor and Description |
|---|
MaximumPrecision(int precision)
Create an instance with the given precision.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
toDecimal(double value,
DecimalAppender decimalAppender)
Convert
value rounding to at most precision decimal places. |
boolean |
toDecimal(float value,
DecimalAppender decimalAppender)
Convert
value rounding to at most precision decimal places. |
public MaximumPrecision(int precision)
precision - number of decimal places, 0-18 inclusiveIllegalArgumentException - if precision is outside that rangepublic boolean toDecimal(double value,
DecimalAppender decimalAppender)
value rounding to at most precision decimal places.toDecimal in interface Decimaliservalue - the double to convert; must be finitedecimalAppender - the appender receiving the componentstrue if the value was in rangepublic boolean toDecimal(float value,
DecimalAppender decimalAppender)
value rounding to at most precision decimal places.toDecimal in interface Decimaliservalue - the float to convert; must be finitedecimalAppender - the appender receiving the componentstrue if the value was in rangeCopyright © 2026 Chronicle Software Ltd. All rights reserved.