Re: 'currency' question; precision/decimal meaing

From: Jan Wieck <janwieck(at)Yahoo(dot)com>
To: depesz(at)depesz(dot)pl
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: 'currency' question; precision/decimal meaing
Date: 2000-11-15 11:26:22
Message-ID: 200011151126.GAA01627@jupiter.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Yahoo(dot)com #

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin A. Marques 2000-11-15 12:14:18 Re: PHPBuilder article -- Postgres vs MySQL
Previous Message Florian Steffen 2000-11-15 10:49:37 Error during creation of indexes