From: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
---|---|
To: | "Gregory Stark" <stark(at)enterprisedb(dot)com> |
Cc: | justin <justin(at)emproshunts(dot)com>, hitz(at)jamhitz(dot)com, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Chart of Accounts |
Date: | 2008-10-13 19:16:02 |
Message-ID: | b42b73150810131216h11917c1cw85047875e1371853@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Oct 13, 2008 at 6:33 AM, Gregory Stark <stark(at)enterprisedb(dot)com> wrote:
> justin <justin(at)emproshunts(dot)com> writes:
>
>> special note do not use only 2 decimal points in the accounting tables. If
>> your application uses 10 decimal places somewhere then every table in the
>> database that has decimals needs to have the same precision. Nothing is more
>> annoying where a transaction says 1.01 and the other side says 1.02 due to
>> rounding.
>
> FWIW I think this is wrong. You need to use precisely the number of decimal
> places that each datum needs. If you use extra it's just as wrong as if you
> use too few.
>
> For example, when you buy gas/petrol at $1.999/gallon and buy 4 gallons you
> get charged $8.00 not $7.996. If you fail to round at that point you'll find
> that your totals don't agree with the amount of money in your actual bank
> account.
I wonder if there's a more general way to say that, something like:
With a transaction between two systems of different precision, the
greater precision system rounds at that point.
If you want to take a particular system out to extra digits, it's
probably good to record the rounding error as a separate component of
the transaction (that is, if you want everything to balance out
perfectly).
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua Drake | 2008-10-13 19:54:02 | It is official, Replicator is now BSD |
Previous Message | Tom Lane | 2008-10-13 17:53:14 | Re: NATURAL JOINs |