Re: How useful is the money datatype?
От | Guy Rouillier |
---|---|
Тема | Re: How useful is the money datatype? |
Дата | |
Msg-id | 4AC9554B.8040909@burntmail.com обсуждение исходный текст |
Ответ на | Re: How useful is the money datatype? (Rich Shepard <rshepard@appl-ecosys.com>) |
Ответы |
Re: How useful is the money datatype?
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: