From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kaiting Chen <ktchen14(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Does NUMERIC lose precision? |
Date: | 2017-05-29 21:24:10 |
Message-ID: | 2321.1496093050@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Kaiting Chen <ktchen14(at)gmail(dot)com> writes:
> Hi everyone. I’m trying to perform some exact precision arithmetic with PostgreSQL’s NUMERIC type. However I can’t seem to 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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-05-29 22:20:14 | Re: wal_retrieve_retry_interval |
Previous Message | Melvin Davidson | 2017-05-29 21:00:19 | Re: Does NUMERIC lose precision? |