Prevent corr() from returning the wrong results for negative correlation
authorNeil Conway <neilc@samurai.com>
Wed, 19 Sep 2007 22:31:51 +0000 (22:31 +0000)
committerNeil Conway <neilc@samurai.com>
Wed, 19 Sep 2007 22:31:51 +0000 (22:31 +0000)
commitd5e6f4f82802ddb18ec02780d21d0e50d2b30eba
tree8c2a95049cb1ac2c7eb40dbe6f25ec6679d9e518
parenteb4f4f5b7cb0b95fed42fe44d8b91c21529e25d5
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.
src/backend/utils/adt/float.c