Rich Shepard wrote:
On Sun, 4 Oct 2009, Sam Mason wrote:
Withing PG procedures at least in pgsql it is impossible to do 'money'
calculations without a loss of precision.
The point is that on *any* computer it's impossible to perform arbitrary
calculations to infinite precision (i.e. "without a loss of precision as
you put it).
Monetary values have always been an issue with computers. For a while, at
least in the mainframe world of decades ago, binary-coded decimals (BCD)
were a working approach.
Yes, packed decimal is a standard way to handle money with no loss of
precision. And "for a while" would be over 50 years, as packed decimal
is still in use today. All banks rely on it. The best way to avoid
loss of precision with decimal is to use decimal representation, and not
convert to binary at all. There is no reason why PG could not support
packed decimal.
--
Guy Rouillier
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general