#4 Multiple operations and rounding

open
nobody
Joda-Money (4)
5
2012-12-10
2011-09-27
No

It looks like the Money performs all math that might have fractions of cents using a RoundingMode. This will cause issues with multiple operations and money loss. If you multiple by a couple of numbers, do some division, add a few things, do some more division, you'll end up losing multiple cents along the way. This happens frequently in financial applications and many others as well.

There needs to be a way to perform multiple calculations on a Money instance without any rounding and then round at the end. The BigMoney doesn't quite provide this. Perhaps a MoneyMath container (or building pattern) of some sort that can provide multiple operations and in the end provide back a Money instance.

Discussion

  • Sorry for the slow response, the forum wasn't emailing me.

    I guess I'm not sure exactly what you're looking for. BigMoney simply wraps a BigDecimal, and should expose all the key methods to do what you want. Perhaps there is a method from BDecimal that it should expose but doesn't? Happy to take a look a pull requests if that is easier..