From: Tom Lane <tgl@sss.pgh.pa.us>
To: bingyanli@email.ncu.edu.cn
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18951: Precision loss in inner join while using SUM aggregate function
Date: Sun, 08 Jun 2025 11:50:21 -0400
Message-ID: <183009.1749397821@sss.pgh.pa.us> (raw)
In-Reply-To: <18951-3092d80beab3d2ef@postgresql.org>
References: <18951-3092d80beab3d2ef@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> -- judgement: s1 = s2 + s3, However, s2 is not correctly computed
[ shrug... ] If you are expecting exact results, don't use
floating-point arithmetic (ie, use "numeric" not "double precision").
This example, which will result in adding values of enormously
different magnitudes in various orders, is tailor-made to
exhibit roundoff error.
https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-FLOAT
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, bingyanli@email.ncu.edu.cn, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18951: Precision loss in inner join while using SUM aggregate function
In-Reply-To: <183009.1749397821@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox