Hi,

Javadoc says :
"if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) an |ArithmeticException| is thrown."

You should use divide method with rouding parameter :
      divide(divisor, roundingMode)

Pierre
On 11/01/2013 11:30, Deepak Agarwal wrote:
InvoiceServices.java :

billingAmount =
billingAmount.subtract(amountAlreadyIncluded.divide(billingQuantity));

This sometimes causes non terminating decimal problem. Should we use
instead:

billingAmount = billingAmount.subtract(new
BigDecimal(amountAlreadyIncluded.doubleValue()/(billingQuantity.doubleValue())));


Reply via email to