Class MathUtils
java.lang.Object
ch.tocco.nice2.toolbox.api.math.MathUtils
Static class providing utility methods for maths tasks
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimalround(BigDecimal value, BigDecimal rounding) round a decimalvalueto a multiple ofrounding.
Examples: value: 4.3, rounding: 0.25, result: 4.25 value: 4.3, rounding: 0.5, result: 4.5
-
Method Details
-
round
round a decimalvalueto a multiple ofrounding.
- Examples:
- value: 4.3, rounding: 0.25, result: 4.25
- value: 4.3, rounding: 0.5, result: 4.5
- Parameters:
value- a value to roundrounding- a decimal number to round to. Possible values are all elements of {1 / n | n ∈ {1, 2, 3, ...}} ∪ {1, 2, 3, ...}- Returns:
- the rounded value
-