Re: [BUGS] agregate function sum error

From: sferac(at)bo(dot)nettuno(dot)it
To: Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] agregate function sum error
Date: 1998-02-16 10:39:24
Message-ID: Pine.LNX.3.96.980216102604.11072C-100000@nero
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 15 Feb 1998, Marin D wrote:

>
> Hi!
>
> You can try to typecast to float8
>
> I have no idea how MySql is doing SUM() - probably it uses unsigned int
> for SUM() so this gives u twice bigger upper limit - try it with MySql
> with sum exceeding 2^32. I suppose the result will be negative ...
>

Well, I asked this question to MySql mailing list:

> sferac> What's meaning "inf" as a result during a SUM() ?
> sferac> Is it an overflow warning, and if so what's the max range of SUM()
> sferac> before to have an overflow ?
>
> mysql> update t set myfloat=myfloat*9.1;
> sferac> Query OK, 1415 rows affected (4.94 sec)
>
> mysql> select sum(myfloat) from t;
> sferac> 1 row in set (0.04 sec)
>
> sferac> +--------------+
> sferac> | sum(myfloat) |
> sferac> +--------------+
> sferac> | Inf |
> sferac> +--------------+
>
> mysqld does all normal calculation with doubles (bit functions are
> done with longlong); The range of a double is typical something like:
>
> #define DBL_MAX 1.7976931348623157E+308
> #define DBL_MIN 2.2250738585072014E-308
>
> Yours,
> Monty

Isn't it a good solution to implement PostgreSQL SUM() function ?
What do you think about ?

____________________________Jose' Soares Da Silva_____________________________
Via Bazzanese, 69 ),,,( www.sferacarta.com
Casalecchio R.(BO) Italy +|o o|+ sferac(at)bo(dot)nettuno(dot)it
Fax. ++39 51 6131537 /. .\ Tel. ++39 51 591054
---------------------------------(_---_)--------------------------------------
"...when men cease to destroy the animal race the lion
and the lamb can dwell together..." (Joseph Smith)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Frederick W. Reimer 1998-02-16 11:00:24 RE: [HACKERS] Re: [PORTS] v6.3 release ToDo list and supported p
Previous Message Ronald Baljeu 1998-02-16 10:38:50 Re: [HACKERS] Re: [QUESTIONS] trouble grouping rows