T-TEST: Avoid NaN in paired-sample correlation significance calcuation.
authorBen Pfaff <blp@gnu.org>
Fri, 4 Sep 2009 03:09:36 +0000 (20:09 -0700)
committerBen Pfaff <blp@gnu.org>
Fri, 4 Sep 2009 03:09:36 +0000 (20:09 -0700)
commitc649f7f5c4f5b74d48efa3453c38c1458e7ae9a9
tree1e08bffe3bfa9d7b67670d3b712723862e410f2a
parent324b25ac025d75a164ba4506175be6d265681108
T-TEST: Avoid NaN in paired-sample correlation significance calcuation.

Sometimes the correlation comes out just above 1.0 due to inaccuracy of
machine calculation, which causes sqrt(1-corr**2) to yield NaN.  This
commit forces the correlation into the valid range, fixing the problem.

Thanks to Matej Cepl <mcepl@redhat.com> for reporting the problem.
Thanks to John Darrington for suggesting the fix.
src/language/stats/t-test.q