Open alensiljak opened 9 years ago
Alen, I can fix this and other bug in about a week. I'm in the middle of a major relocation.
No, problem, Mikhail. There is a workaround for the bug where, instead of
double value = allocation * totalValue.toDouble() / 100;
Money moneyValue = MoneyFactory.fromDouble(value);
I can simply reverse the operations
Money moneyValue = totalValue.multiply(allocation).divide(100, Constants.DEFAULT_PRECISION);
and the result is correct. And if I have some spare time, I might have a shot at adding isZero() and/or some of the other helper methods. Cheers
Is there any future work planned on this high perormance bigdecimal replacement?
submitted PR #17 (currently a test-case only) so that everyone is aware of this bug until fixed.
see https://github.com/mikvor/money-conversion/pull/17 for the fix.
Here is a test case. Real-world situation is a calculation of a percentage of the total sum.
The wrong number comes out of the multiplication with 100.