Re: 'currency' question; precision/decimal meaing - Mailing list pgsql-general

From Jan Wieck
Subject Re: 'currency' question; precision/decimal meaing
Date
Msg-id 200011151126.GAA01627@jupiter.jw.home
Whole thread Raw
In response to Re: 'currency' question; precision/decimal meaing  (hubert depesz lubaczewski <depesz@depesz.pl>)
List 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 by date:

Previous
From: "Enrico Comini"
Date:
Subject: What language
Next
From: "Adam Lang"
Date:
Subject: Re: What language