Re: [GENERAL] Does NUMERIC lose precision? - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] Does NUMERIC lose precision?
Date
Msg-id 2321.1496093050@sss.pgh.pa.us
Whole thread Raw
In response to [GENERAL] Does NUMERIC lose precision?  (Kaiting Chen <ktchen14@gmail.com>)
List pgsql-general
Kaiting Chen <ktchen14@gmail.com> writes:
> Hi everyone. I’m trying to perform some exact precision arithmetic with PostgreSQL’s NUMERIC type. However I can’t
seemto 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


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: [GENERAL] Does NUMERIC lose precision?
Next
From: Michael Paquier
Date:
Subject: Re: [GENERAL] wal_retrieve_retry_interval