Re: BUG #5150: math bug

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5150: math bug
Дата
Msg-id 22942.1256959769@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #5150: math bug  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: BUG #5150: math bug  (John R Pierce <pierce@hogranch.com>)
Список pgsql-bugs
Robert Haas <robertmhaas@gmail.com> writes:
> In general, floating point arithmetic is inaccurate and sucky.  That
> has nothing to do with PostgreSQL; it's just life.

Actually, I think these examples are being done in "numeric" not float8.
Your comment stands though --- 1.0/3.0 does not give the exact rational
number 1/3, but some finite decimal approximation to it, which when
multiplied by 3 will not produce exactly 1.0.

There is special-purpose software out there that can compute exactly
with rational numbers, but you aren't likely to find it embedded in any
general-purpose tools like databases --- the use-case just isn't wide
enough.  One reason why not is that it'll still fall down on irrational
numbers.

            regards, tom lane

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

Предыдущее
От: "Pierre"
Дата:
Сообщение: BUG #5155: Error compiling postgresql-8.5alpha2
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5155: Error compiling postgresql-8.5alpha2