On Thu, 4 Dec 2003, Jan Wieck wrote:
> Graham Leggett wrote:
>
> > Christopher Browne wrote:
> >
> > What I have done is store the currency amounts as bigints, at the same
> > precision defined for the currency (ie cents for dollars, pence for
> > pounds, etc). This guarantees that you don't get any rounding errors
> > when storing the figures as a floating point type. When manipulating the
> > numbers, I use Java BigDecimals, which don't lose any precision either,
> > and convert back to bigints to store in the database.
>
> You won't get any rounding errors in NUMERIC either. What people should
> be concerned of is to find an arbitrary precision package for the
> frontend programming language they're using.
>
I agree, I use BigDecimal's in Java, and NUMERIC's in PostgreSQL, they
seem like a perfect match. Floating point numbers are not suitable for
money in my opinion.