[GENERAL] Numeric numbers

Поиск
Список
Период
Сортировка
От Олег Самойлов
Тема [GENERAL] Numeric numbers
Дата
Msg-id 1504361765.16542.8.camel@mipt.ru
обсуждение исходный текст
Ответы Re: [GENERAL] Numeric numbers  (Francisco Olarte <folarte@peoplecall.com>)
Re: [GENERAL] Numeric numbers  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Hi all. I have silly question. Look at "numeric" type. According to
docs it must be "up to 131072 digits before the decimal point; up to
16383 digits after the decimal point". Well, lets see.

=> select 1::numeric/3;
        ?column?        
------------------------
 0.33333333333333333333

Well, I expect 16383 digits after ".". But nope.
=> select (1::numeric/3-0.33333333333333333333)*1e20;
        ?column?        
------------------------
 0.00000000000000000000
=> select (1::numeric/3-0.33333333333333333332)*1e20;
        ?column?        
------------------------
 1.00000000000000000000

There is only 20 "3" after ".". Well, may be this is not a problem, but
why are they infinite number of "0" after the point? I can write even

=> select (1::numeric/3-0.33333333333333333333)*1e100000;
        ?column?        
------------------------
 0.00000000000000000000

Result the same. According to the docs: "Numeric values are physically
stored without any extra leading or trailing zeroes."


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

Предыдущее
От: Ken Tanzer
Дата:
Сообщение: Re: [GENERAL] Fields re-ordered on JOIN with * and USING
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: [GENERAL] Numeric numbers