Re: Anomaly with SUM(). - Mailing list pgsql-general

From Anthony Best
Subject Re: Anomaly with SUM().
Date
Msg-id 3F3404D6.2020100@digitalflex.net
Whole thread Raw
In response to Re: Anomaly with SUM().  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:

>Anthony Best <abest@digitalflex.net> writes:
>
>
>>I've noticed that the SUM() seems to overflow under some situations.
>>The only difference is the order that the data is retrived from the
>>database.
>>
>>
>
>
>
>>accounting=# select  sum(amount)  from transactions, chart WHERE
>>account=chart.id;
>>         sum
>>---------------------
>>5.6843418860808e-14
>>(1 row)
>>
>>
>
>
>
>>accounting=# select  sum(amount)  from transactions, chart WHERE
>>account=chart.id AND amount=amount;
>>sum
>>-----
>>   0
>>(1 row)
>>
>>
>
>That's not an overflow, it's merely roundoff error.  If this surprises
>you, possibly you should be using type NUMERIC instead of float.
>
>            regards, tom lane
>
>
Oh, thats right. 'overflow' was the wrong word. I was thinking numeric
was used internally for 'double precision' for some reason.

thank you.
Anthony.


pgsql-general by date:

Previous
From: DeJuan Jackson
Date:
Subject: Re: 7.3.3 behaving differently on OS X 10.2.6 and FreeBSD
Next
From: "Dann Corbit"
Date:
Subject: Re: Anomaly with SUM().