Re: numeric precision when raising one numeric to another.

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, Scott Marlowe <smarlowe(at)g2switchworks(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: numeric precision when raising one numeric to another.
Date: 2005-05-24 16:10:00
Message-ID: 20050524161000.GE8743@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

On Fri, May 20, 2005 at 01:03:08PM -0400, Tom Lane wrote:

> But having said that, I don't have a problem with putting in a
> pg_operator entry for numeric_power. And if someone wants to improve
> the scale factor calculations therein, go for it.

Oh, and while at it, it would be nice to solve the modulo bug that still
lurks there:

alvherre=# select 12345678901234567890 % 123;
?column?
----------
-45
(1 fila)

alvherre=# select 12345678901234567890 % 123::numeric(4,1);
?column?
----------
78.0
(1 fila)

alvherre=# select 12345678901234567890 % 123::numeric(3,0);
?column?
----------
-45
(1 fila)

alvherre=# select version();
version
----------------------------------------------------------------------------------------------
PostgreSQL 8.1devel on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.6 (Debian 1:3.3.6-4)
(1 fila)

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"I call it GNU/Linux. Except the GNU/ is silent." (Ben Reiter)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc Soleda 2005-05-24 16:18:46 pg_autovacuum WinXP service
Previous Message Sebastian Böck 2005-05-24 16:05:03 Re: Update on tables when the row doesn't change

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2005-05-24 16:15:15 Re: plperl strict mode
Previous Message Andrew Dunstan 2005-05-24 15:53:45 Re: plperl strict mode