Search Postgresql Archives

Re: How useful is the money datatype?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux