# Re: NUMERIC private methods?

From: Bruce Momjian Tom Lane Robert Haas , Andrew Gierth , Heikki Linnakangas , David Fetter , PG Hackers Re: NUMERIC private methods? 2015-03-22 04:00:40 20150322040040.GI10795@momjian.us Raw Message | Whole Thread | Download mbox | Resend email 2014-12-16 06:34:42 from David Fetter  2014-12-16 08:23:39 from Heikki Linnakangas   2014-12-16 09:01:47 from Andrew Gierth    2014-12-16 13:31:45 from David Fetter   2014-12-16 15:16:19 from Tom Lane    2014-12-18 05:11:51 from Andrew Gierth     2014-12-18 15:21:26 from Tom Lane      2014-12-18 17:58:35 from Jim Nasby      2014-12-19 02:40:34 from Robert Haas       2014-12-19 02:51:37 from Alvaro Herrera        2014-12-19 17:44:54 from David Fetter       2014-12-19 04:51:12 from Tom Lane        2014-12-19 13:50:33 from Robert Haas         2014-12-19 15:56:34 from Tom Lane          2014-12-19 16:38:23 from Robert Haas        2015-03-22 04:00:40 from Bruce Momjian 📎         2015-03-22 04:08:32 from Andrew Gierth          2015-03-24 23:58:07 from Bruce Momjian pgsql-hackers

On Thu, Dec 18, 2014 at 11:51:12PM -0500, Tom Lane wrote:
> If you're doing any sort of higher math or statistics, I stand by my
> statement that you'd better think rather than just blindly assume that
> numeric is going to be better for you. A moment's fooling about finds
> this example, which is pretty relevant to the formula we started this
>
> regression=# select (1234::numeric/1235) * 1235;
> ?column?
> ---------------------------
> 1234.00000000000000000100
> (1 row)
>
> regression=# select (1234::float8/1235) * 1235;
> ?column?
> ----------
> 1234
> (1 row)
>
> What it boils down to is that numeric is great for storing given decimal
> inputs exactly, and it can do exact addition/subtraction/multiplication
> on those too, but as soon as you get into territory where the result is
> fundamentally inexact it is *not* promised to be better than float8.
> In fact, it's designed to be more or less the same as float8; see the

Based on the analysis above, I have written the attached patch to the
NUMERIC docs to mention this.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
numeric.diff text/x-diff 1.2 KB

### Browse pgsql-hackers by date

From Date Subject
Next Message Andrew Gierth 2015-03-22 04:08:32 Re: NUMERIC private methods?
Previous Message Andrew Gierth 2015-03-22 03:28:01 debug_sortsupport GUC?