Re: 'currency' question; precision/decimal meaing

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: 'currency' question; precision/decimal meaing
Дата
Msg-id 200011151126.GAA01627@jupiter.jw.home
обсуждение исходный текст
Ответ на Re: 'currency' question; precision/decimal meaing  (hubert depesz lubaczewski <depesz@depesz.pl>)
Список pgsql-general
hubert depesz lubaczewski wrote:
[Charset iso-8859-2 unsupported, filtering to ASCII...]
> On Fri, Nov 10, 2000 at 01:13:23PM -0500, Will Fitzgerald wrote:
> > I want to store prices in a table. What's the best way to do this (since
> > 'money' is deprecated)?
>
> use int4 (or int8) and assume that the value is multipied by 100 (or another
> value - depends on your local currency.
> for example:
> $400
> i will store as
> 40000
> $2.34
> i will store as
> 234
>
> this is much better, and safer than useing floating point fields.

    NUMERIC   is   arbitrary   precision,  allows  all  kinds  of
    computation and the internal storage and handling is  OK  for
    bookkeeping  purposes  according to german law (which doesn't
    allow floating point because of possible rounding).

    NUMERIC is the choice for amounts of money.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #


В списке pgsql-general по дате отправления:

Предыдущее
От: "Enrico Comini"
Дата:
Сообщение: What language
Следующее
От: "Adam Lang"
Дата:
Сообщение: Re: What language