| From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Improve overflow/underflow handling in regr_r2(). |
| Date: | 2026-06-03 08:03:37 |
| Message-ID: | E1wUgZd-000rxP-2C@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Improve overflow/underflow handling in regr_r2().
Commit 6498287696d improved corr()'s final function to cope with
overflow/underflow in the final calculation, and clamped its result to
[-1, 1] in case of roundoff error. Improve regr_r2() in a similar way,
clamping its result to [0, 1].
Arguably this is a bug fix, but given the lack of prior complaints,
refrain from back-patching, as we did with 6498287696d.
Reported-by: Chengpeng Yan <chengpeng_yan(at)outlook(dot)com>
Author: Chengpeng Yan <chengpeng_yan(at)outlook(dot)com>
Reviewed-by: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/33E01656-BB3B-46E9-A41F-24A01A7C35F4@outlook.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d58ec50e0faae364fa59cdb88eba7e23b55ab583
Modified Files
--------------
src/backend/utils/adt/float.c | 37 ++++++++++++++++++--
src/test/regress/expected/aggregates.out | 58 +++++++++++++++++++++-----------
src/test/regress/sql/aggregates.sql | 19 ++++++++---
3 files changed, 87 insertions(+), 27 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dean Rasheed | 2026-06-03 08:22:50 | pgsql: Improve overflow/underflow handling in regr_intercept(). |
| Previous Message | Fujii Masao | 2026-06-03 07:53:58 | pgsql: vacuumdb: Fix --analyze-in-stages skipping partitioned tables |