Re: BUG #3467: Sum strange behaviour

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: BUG #3467: Sum strange behaviour
Дата
Msg-id 469DE252.6060405@enterprisedb.com
обсуждение исходный текст
Ответ на BUG #3467: Sum strange behaviour  ("Alex" <AVShutko@mail.khstu.ru>)
Список pgsql-bugs
Alex wrote:
> I have a database with some float numbers (all of them are 2 digits
> presision). When I do select sum() I get this: 96.3100000000001
> ...
> Is this bug or future ?

A feature. Floating point numbers can't generally represent a decimal
number exactly, so you get some rounding errors. Usually the errors are
small enough that they don't show up, but sometimes they do, like in
this example. I would recommend using NUMERIC instead of floats for
anything where the input data is in decimal format.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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

Предыдущее
От: "Alex"
Дата:
Сообщение: BUG #3467: Sum strange behaviour
Следующее
От: "SRIDHARAN"
Дата:
Сообщение: BUG #3469: SELECT QRY