Reputation: 4685
I use jsr-354
org.javamoney.moneta
api for Currency.
I need to divide money, for example I want set roundings to 0.25
So 100 dollars / 3 should be 33.25
By default
val dollar100 = FastMoney.of(100, Monetary.getCurrency(Locale.US))
val res = dollar100.divide(3)
result is 33.3333
Is there a build in way to set roundings for that, or maybe other solutions?
Upvotes: 2
Views: 800
Reputation: 642
I don't think The JSR 354 RIs (Moneta / Moneta-BP) provide that out of the box, but you can certainly define your own MonetaryRounding
for such case. If it makes sense for a large number of users, we'd be happy to consider it for JavaMoney-Lib or Shelter.
Upvotes: 0