Problem with multiplication o money by decimal amount
The-Q opened this issue · comments
Alexander commented
Hi, there. I've found strange behaviour with multiplication by decimal amount. For examlple the following code :
(ma/multiply (ma/amount-of mc/USD 45) 10.1)
results in
#<Money USD 450.00>
where are result as I think should be
#<Money USD 454.50>
Is there any bug in multiplication?
Michael Klishin commented
multiply
is missing another arity that lets you specify rounding mode. Feel free to submit a pull request that adds it, it should be identical to divide
.
Michael Klishin commented
In fact, the only multiplyBy version that accepts doubles [1] requires specifying a rounding mode. In your case, multiplier is implicitly coerced to a long.
http://www.joda.org/joda-money/apidocs/org/joda/money/Money.html#multipliedBy(java.math.BigDecimal, java.math.RoundingMode)
Michael Klishin commented
Fixed in 1.4.0
which is already up on Clojars.
Alexander commented
Thanks.