ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Gray <scott.g...@hotwaxmedia.com>
Subject Re: Bigdecimal divide causes not terminating decimal
Date Sat, 12 Jan 2013 02:34:54 GMT
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 <dagarwal82@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

Mime
View raw message