public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dean Rasheed <[email protected]>
To: [email protected]
Subject: pgsql: Improve overflow/underflow handling in regr_r2().
Date: Wed, 03 Jun 2026 08:03:37 +0000
Message-ID: <[email protected]> (raw)

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 <[email protected]>
Author: Chengpeng Yan <[email protected]>
Reviewed-by: Dean Rasheed <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/[email protected]

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(-)



view thread (2+ messages)  latest in thread

reply

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Improve overflow/underflow handling in regr_r2().
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox