commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: Money Class?
Date Fri, 18 Mar 2005 07:14:04 GMT
Scale depends on the currency. For example Euro is displayed with 2 
decimals but internal calculations should be done with 4 decimals.

If you are doing a lot of divisions/multiplications then you better 
don't limit the intermediate results or the rounding errors will kill 
the correctness of the result.

I also recommend creating your own Money Class with a bigdecimal 
inside. Then you can add method to read/write the value with the 
correct number of decimal digits.

-- Dirk

Lukas Bradley wrote:
>>    I always use BigDecimal for money, and convert to required formats
>> when viewing. Otherwise, if you need to deal with other currencies, you
>> might run into trouble.
> Do you limit (scale) your BigDecimal to 2 places?  If so, which 
> constructor do you use?
> Thanks for the reply.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message