-
-
Notifications
You must be signed in to change notification settings - Fork 123
Closed
Labels
Description
Looking at the code I've noticed that Money.toString uses the explicit rounding mode HALF_EVEN, while Money.toFormattedString does not. Is this the intended behaviour?
Speaking about rounding modes, I'd find useful a method to apply rounding to a Money instance. What I'm doing in my code right now is something like this:
implicit class MoneyOps(m: Money) {
def rounded: Money = Money(
value = m.amount.setScale(m.currency.formatDecimals, BigDecimal.RoundingMode.HALF_EVEN),
currency = m.currency
)
}This may be useful to apply rounding in calculations on purpose.