Re: round(50.5) = 50

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: round(50.5) = 50
Дата
Msg-id 200402290400.17831.peter_e@gmx.net
обсуждение исходный текст
Ответ на round(50.5) = 50  (Philipp Matthias Hahn <Philipp.Hahn@informatik.uni-oldenburg.de>)
Ответы Re: round(50.5) = 50  (Philipp Matthias Hahn <Philipp.Hahn@informatik.uni-oldenburg.de>)
Список pgsql-bugs
Philipp Matthias Hahn wrote:
> # SELECT round(5.5::float4),round(50.5::float4);
>   round | round
> -------+-------
>       6 |    50
> (1 row)
>
> I think this is a bug, since I would expect 6 and 51.

The default rounding mode for floating point (determined by your C
library, mostly) it to round toward the closest even number.  If you
are at all concerned abou that, you probably shouldn't be using
floating point, but rather numeric.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Optimizer problem with subselect.c?
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: About Create Assertion