Re: BUG #18951: Precision loss in inner join while using SUM aggregate function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: bingyanli(at)email(dot)ncu(dot)edu(dot)cn
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18951: Precision loss in inner join while using SUM aggregate function
Date: 2025-06-08 15:50:21
Message-ID: 183009.1749397821@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-06-08 16:14:07 Re: tlsv1 alert unknown ca error on cert authentication
Previous Message Junwang Zhao 2025-06-08 15:44:02 Re: BUG #18951: Precision loss in inner join while using SUM aggregate function