Re: Re: Postgres int rounding

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Re: Postgres int rounding
Дата
Msg-id 200101270429.XAA02250@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Postgres int rounding  ("Michael Richards" <michael@fastmail.ca>)
Список 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@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: select fails on indexed varchars.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug with foreign keys and importing from a pg_dump file?