Re: [GENERAL] Does NUMERIC lose precision?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] Does NUMERIC lose precision?
Дата
Msg-id 2321.1496093050@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [GENERAL] Does NUMERIC lose precision?  (Kaiting Chen <ktchen14@gmail.com>)
Список pgsql-general
Kaiting Chen <ktchen14@gmail.com> writes:
> Hi everyone. I’m trying to perform some exact precision arithmetic with PostgreSQL’s NUMERIC type. However I can’t
seemto get the unparameterized NUMERIC type to perform exact precision arithmetic: 

Division is inherently inexact, except in special cases.  If you think
that 1/(2^64) should be carried out to enough digits to be exact,
what would you have us do with 1/3?

The actual behavior is that it will choose a result scale (number of
digits after the decimal point) that is dependent on the scales of the
input arguments, but not on their precise values.  I don't recall the
details beyond that.

            regards, tom lane


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

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: [GENERAL] Does NUMERIC lose precision?
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [GENERAL] wal_retrieve_retry_interval