From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Purpose of rscale/dscale in NUMERIC? |
Date: | 2002-10-01 21:24:50 |
Message-ID: | 17150.1033507490@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-10-01 22:10:57 | Re: 7.2.3 patching done |
Previous Message | scott.marlowe | 2002-10-01 21:24:07 | Re: table lock and record lock |