From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)surnet(dot)cl> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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-31 04:22:53 |
Message-ID: | 200505310422.j4V4Mrd23842@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-patches |
Alvaro Herrera wrote:
> On Mon, May 30, 2005 at 11:29:48PM -0400, Bruce Momjian wrote:
>
> > test=> select 12345678901234567890 / 123;
> > ?column?
> > --------------------
> > 100371373180768845
> > (1 row)
>
> Well, that's a bug, right?
I don't think so. The fuller answer is
100371373180768844.63414634146341463414, and that rounded to the nearest
integer is 100371373180768845. I think people expect % do to that,
except for integers. You could argue that numerics with zero scale are
integers, but NUMERIC % NUMERIC doesn't behave like an integer operator
--- it rounds to the proper precision.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Harding | 2005-05-31 04:30:07 | Re: Carriage return in text fields |
Previous Message | Alvaro Herrera | 2005-05-31 03:48:27 | Re: numeric precision when raising one numeric to another. |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-05-31 05:25:49 | Re: Backslash handling in strings |
Previous Message | Bruce Momjian | 2005-05-31 04:20:19 | Re: Backslash handling in strings |