| От | Tom Lane |
|---|---|
| Тема | Purpose of rscale/dscale in NUMERIC? |
| Дата | |
| Msg-id | 17150.1033507490@sss.pgh.pa.us обсуждение исходный текст |
| Список | pgsql-hackers |
What is the reason for maintaining separate rscale and dscale values in
numeric variables?
I am finding that this arrangement leads to some odd results, for
example this:
regression=# select (exp(ln(2.0)) - 2.0); ?column?
----------------------0.0000000000000000
(1 row)
regression=# select (exp(ln(2.0)) - 2.0) * 100000; ?column?
----------------------0.0000000000000010
(1 row)
The difference between rscale and dscale allows some "hidden" digits to
be carried along in an expression result, and then possibly exposed
later. This seems pretty nonintuitive for an allegedly exact
calculational datatype. ISTM the policy should be "what you see is what
you get" - no hidden digits. That would mean there's no need for
separating rscale and dscale, so I'm wondering why they were put in
to begin with.
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера