From: | Олег Самойлов <olleg(at)mipt(dot)ru> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Numeric numbers |
Date: | 2017-09-02 14:16:05 |
Message-ID: | 1504361765.16542.8.camel@mipt.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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."
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco Olarte | 2017-09-02 15:54:02 | Re: Numeric numbers |
Previous Message | Ken Tanzer | 2017-09-02 01:45:13 | Re: Fields re-ordered on JOIN with * and USING |