model-writtenrun 869 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Chengpeng Yan demonstrated that regr_r2() could return NaN for perfectly correlated inputs at extreme scales and proposed sharing corr()'s stabilized calculation as a fallback while preserving the normal calculation and SQL special cases #1.
- Dean Rasheed retained the numerical strategy but kept the code local to regr_r2(), removed an unnecessary zero-covariance shortcut, improved explanatory comments, and chose more reliable overflow test inputs #2.
- Tom Lane approved the revised regr_r2() patch and agreed with Dean's proposal to target PostgreSQL 19 without backpatching, while recommending release-management consultation; Dean then requested that concurrence #3 #4.
- Tom identified a similar risk in regr_intercept() and suggested dividing before multiplying, but Dean supplied a counterexample where that ordering would overflow; a logarithmic alternative raised additional sign and zero-handling complications #5 #6 #7.
- Dean proposed recovering with frexp()/ldexp() and explained why underflow also mattered; Tom supported the approach and requested protection for infinite and NaN inputs, which Dean included in a separate patch applied atop the regr_r2() change #8 #9 #10.
- Chengpeng approved the revised regr_r2() patch, then reviewed the intercept addition, reporting malformed patch headers, suggesting a clearer variable name, and requesting underflow and possibly Inf/NaN tests #11 #12.
- Dean posted both patches together with corrected patch formatting and an intercept underflow test, retained the name dy because its meaning was documented, and declined an Inf/NaN test because the guard avoided unspecified exponent values without changing results; Chengpeng approved the series and reported passing regression tests on Apple Silicon #13 #14.
- Dean committed the regr_r2() patch unchanged as d58ec50e0f and the regr_intercept() patch unchanged as eb8e76e130, both from #13, and confirmed that both had landed on the development branch without backpatching, completing the thread's work #15.