Re: How useful is the money datatype?

Поиск
Список
Период
Сортировка
Искать
От
Craig Ringer
Тема
Re: How useful is the money datatype?
Дата
Msg-id
1255402983.4702.11.camel@wallace.localnet
Ответ на
Список
Дерево обсуждения
How useful is the money datatype? Thom Brown <thombrown@gmail.com>
Re: How useful is the money datatype? Peter Eisentraut <peter_e@gmx.net>
Re: How useful is the money datatype? Raymond O'Donnell <rod@iol.ie>
Re: How useful is the money datatype? Thom Brown <thombrown@gmail.com>
Re: How useful is the money datatype? Filip Rembiałkowski <plk.zuber@gmail.com>
Re: How useful is the money datatype? Peter Geoghegan <peter.geoghegan86@gmail.com>
Re: How useful is the money datatype? Grzegorz Jaśkiewicz <gryzman@gmail.com>
Re: How useful is the money datatype? Greg Stark <gsstark@mit.edu>
Re: How useful is the money datatype? Raymond O'Donnell <rod@iol.ie>
Re: How useful is the money datatype? Sam Mason <sam@samason.me.uk>
Re: How useful is the money datatype? Merlin Moncure <mmoncure@gmail.com>
Re: How useful is the money datatype? Sam Mason <sam@samason.me.uk>
Re: How useful is the money datatype? "V S P" <pgsql-general@postgresql.org>
Re: How useful is the money datatype? Sam Mason <sam@samason.me.uk>
Re: How useful is the money datatype? Craig Ringer <craig@postnewspapers.com.au>
Re: How useful is the money datatype? Rich Shepard <rshepard@appl-ecosys.com>
Re: How useful is the money datatype? Sam Mason <sam@samason.me.uk>
Re: How useful is the money datatype? justin <justin@emproshunts.com>
Re: How useful is the money datatype? Guy Rouillier <guyr-ml1@burntmail.com>
Re: How useful is the money datatype? Christophe Pettus <xof@thebuild.com>
Re: How useful is the money datatype? Guy Rouillier <guyr-ml1@burntmail.com>
Re: How useful is the money datatype? Bruce Momjian <bruce@momjian.us>
Re: How useful is the money datatype? Guy Rouillier <guyr-ml1@burntmail.com>
Re: How useful is the money datatype? John R Pierce <pierce@hogranch.com>
Re: How useful is the money datatype? Christophe Pettus <xof@thebuild.com>
Re: How useful is the money datatype? Sam Mason <sam@samason.me.uk>
Re: How useful is the money datatype? Peter Geoghegan <peter.geoghegan86@gmail.com>
Re: How useful is the money datatype? Thom Brown <thombrown@gmail.com>
On Sun, 2009-10-04 at 17:12 +0100, Sam Mason wrote:

> > There is an open source library by IBM that I use in my C++ code to do
> > this, and may be it can be incorporated into PG
> >
> > it is called decNumber
> > http://speleotrove.com/decimal/decnumber.html
> 
> How would this help over PG's existing numeric type?

I don't see it either. Pg's NUMERIC type is quite suitable for mixing
large and small values in calculations with reasonable precision.


test=> SELECT NUMERIC '100000000' * NUMERIC '0.00000000009';
 0.00900000000


test=> SELECT NUMERIC '10000090009.000000000000000001' 
            / NUMERIC '0.0000000000000000000000002';

50000450045000000000000000005000000.0000000000000000000000000


Sometimes you have to be very careful to make sure that Pg interprets
operands as NUMERIC, though, rather than as floats.


I've been extremely happy with the NUMERIC data type when working with
monetary values. For scientific use I wish there was an equivalent type
with explicit accumulation of error so I knew how much of the value was
valid, but you don't need that for financial calculations.


--
Craig Ringer


В списке pgsql-general по дате отправления
От: Craig Ringer
Дата:
От: Craig Ringer
Дата:
Сообщение: Re:
FAQ