Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbf4fdc

Browse files
author
Neil Conway
committed
Prevent corr() from returning the wrong results for negative correlation
values. The previous coding essentially assumed that x = sqrt(x*x), whichdoes not hold for x < 0.Thanks to Jie Zhang at Greenplum and Gavin Sherry for reporting thisissue.
1 parent4893ead commitbbf4fdc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

‎src/backend/utils/adt/float.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.150 2007/06/05 21:31:06 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.151 2007/09/19 22:31:48 neilc Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2274,8 +2274,7 @@ float8_corr(PG_FUNCTION_ARGS)
22742274
if (numeratorX <=0||numeratorY <=0)
22752275
PG_RETURN_NULL();
22762276

2277-
PG_RETURN_FLOAT8(sqrt((numeratorXY*numeratorXY) /
2278-
(numeratorX*numeratorY)));
2277+
PG_RETURN_FLOAT8(numeratorXY /sqrt(numeratorX*numeratorY));
22792278
}
22802279

22812280
Datum

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp