Doubles have no place in financial transactions, the correct fix is to set a 
scale on the divide operation.

Regards
Scott

On 11/01/2013, at 11:30 PM, Deepak Agarwal <dagarwa...@gmail.com> 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())));
> 
> -- 
> Thanks,
> Deepak Agarwal,
> 
> Mobile: +91 9501190044

Reply via email to