| From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> | 
|---|---|
| To: | Michael Richards <michael(at)fastmail(dot)ca> | 
| Cc: | tgl(at)sss(dot)pgh(dot)pa(dot)us, max(at)nino(dot)ru, pgsql-bugs(at)postgresql(dot)org | 
| Subject: | Re: Re: Postgres int rounding | 
| Date: | 2001-01-27 04:29:09 | 
| Message-ID: | 200101270429.XAA02250@candle.pha.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
> Is postgres going to use the scientific method of rounding or just 
> the simple one? Or even make it configurable. As I recall, the 
> scientific method says that 4.5 should be rounded to 4 and 5.5 should 
> be rounded to 6. The idea was that even numbers were easier to work 
> with and rounding all the x.5 numbers up as the common method says 
> will eventually skew your average. Rounding evens down and odds up 
> would probably generate a number of bug reports from people who are 
> not aware of this though...
I think some standard required the even/odd rounding behavour.
> 
> -Michael
> 
> > The fact that 5*27.81*100 != 27.81*100*5 is certainly a
> > garden-variety floating-point roundoff error.  However, I think
> > Max has a fair complaint here: it seems float-to-int8 conversion
> > is truncating, not rounding like the other conversions to integer
> > do.
> >
> > regression=# select 4.7::float8::int4;
> > ?column?
> > ----------
> > 5
> > (1 row)
> >
> > regression=# select 4.7::float8::int8;
> > ?column?
> > ----------
> > 4
> > (1 row)
> >
> > Seems to me this is a bug we should fix.
> 
> _________________________________________________________________
>      http://fastmail.ca/ - Fast Free Web Email for Canadians
> 
-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2001-01-27 07:09:21 | Re: Bug with foreign keys and importing from a pg_dump file? | 
| Previous Message | Tom Lane | 2001-01-27 02:34:21 | Re: select fails on indexed varchars. |