Re: Money data type in PostgreSQL?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Graham Leggett <minfrin(at)sharp(dot)fm>
Cc: Christopher Browne <cbbrowne(at)acm(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Money data type in PostgreSQL?
Date: 2003-12-06 04:03:47
Message-ID: 3FD15523.9090400@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Graham Leggett wrote:
> Jan Wieck wrote:
>
>> You won't get any rounding errors in NUMERIC either. What people should
>> be concerned of is to find an arbitrary precision package for the
>> frontend programming language they're using.
>
> What is the definition of a numeric number? I understand (from studying
> numeric methods all those years ago) that the base 10 decimal number 0.1
> cannot be stored exactly in base 2 floating point, thus my use of
> integers - is numeric an arbitrary precision concept?

The PostgreSQL datatype NUMERIC is performing decimal arithmetic. The
original I wrote used to do it string based, with one digit per byte but
stored the number as some sort of BCD, one digit per nibble. Tom Lane
changed that a while back into base 10,000 storage and calculation,
which has the advantages of doing 4 digits per loop and no need to
convert back and forth between the storage and the computational
representation.

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 Wind Wood 2003-12-06 07:15:05 Re: query and pg_dump problem on my postgresql 6.5.3/Redhat 6.2
Previous Message Tom Lane 2003-12-06 03:18:33 Re: 7.4 Crashed... Why?