d'oh -- now patch is attached

On Fri, 30 Mar 2012, Yaroslav Halchenko wrote:

> patch is attached here as well

-- 
=------------------------------------------------------------------=
Keep in touch                                     www.onerussian.com
Yaroslav Halchenko                 www.ohloh.net/accounts/yarikoptic
From ebe8fbed067a95cfe03a8c900cfe9624201520fc Mon Sep 17 00:00:00 2001
From: Yaroslav Halchenko <[email protected]>
Date: Fri, 30 Mar 2012 21:48:30 -0400
Subject: [PATCH] BUG: smirnov -- make comparison robust to handle NaNs

any comparison (< or >=) with NaN is False, so check to belong to the range
[x,y] must be done with (>=x)&&(<=y) and not !((<x)||(>y))

This issue happens to be critical especially for big-endian architectures
leading to stalling in smirnov due to excessive looping later in the code.

References:
  http://bugs.debian.org/cgi-bin/bugreport.cgi\?bug\=653948
  http://mail.scipy.org/pipermail/scipy-dev/2012-March/017298.html
---
 scipy/special/cephes/kolmogorov.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scipy/special/cephes/kolmogorov.c b/scipy/special/cephes/kolmogorov.c
index f587b6a..d78e0ae 100644
--- a/scipy/special/cephes/kolmogorov.c
+++ b/scipy/special/cephes/kolmogorov.c
@@ -35,7 +35,9 @@ smirnov (n, e)
   int v, nn;
   double evn, omevn, p, t, c, lgamnp1;
 
-  if (n <= 0 || e < 0.0 || e > 1.0)
+  /* This comparison should assure returning NaN whenever
+     e is NaN itself.  In original || form it would proceed */
+  if (!(n > 0 && e >= 0.0 && e <= 1.0))
     return (NPY_NAN);
   if (e == 0.0) return 1.0;
   nn = (int) (floor ((double) n * (1.0 - e)));
-- 
1.7.8.3

_______________________________________________
Python-modules-team mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team

Reply via email to