Prevent corr() from returning the wrong results for negative correlation

Neil Conway <neilc@samurai.com>

Commit: bbf4fdc2538097bb3103806e1419ceef1f289203
Author: Neil Conway <neilc@samurai.com>
Date: 2007-09-19T22:31:48Z
Releases: 8.3.0
Prevent corr() from returning the wrong results for negative correlation
values. The previous coding essentially assumed that x = sqrt(x*x), which
does not hold for x < 0.

Thanks to Jie Zhang at Greenplum and Gavin Sherry for reporting this
issue.

Files

PathChange+/−
src/backend/utils/adt/float.c modified +2 −3