Skip to content
This repository
Browse code

BUG: special: nan safety in smirnovi & kolmogi

  • Loading branch information...
commit 2858f452b8083f1eca4499889e6b43942c2eda03 1 parent f7083b6
Pauli Virtanen pv authored
4 scipy/special/cephes/kolmogorov.c
@@ -117,7 +117,7 @@ smirnovi (n, p)
117 117 double e, t, dpde;
118 118 int iterations;
119 119
120   - if (p <= 0.0 || p > 1.0)
  120 + if (!(p > 0.0 && p <= 1.0))
121 121 {
122 122 mtherr ("smirnovi", DOMAIN);
123 123 return (NPY_NAN);
@@ -165,7 +165,7 @@ kolmogi (p)
165 165 double y, t, dpdy;
166 166 int iterations;
167 167
168   - if (p <= 0.0 || p > 1.0)
  168 + if (!(p > 0.0 && p <= 1.0))
169 169 {
170 170 mtherr ("kolmogi", DOMAIN);
171 171 return (NPY_NAN);
3  scipy/special/tests/test_basic.py
@@ -268,6 +268,7 @@ def test_kn(self):
268 268
269 269 def test_kolmogi(self):
270 270 assert_equal(cephes.kolmogi(1),0.0)
  271 + assert_(np.isnan(cephes.kolmogi(np.nan)))
271 272 def test_kolmogorov(self):
272 273 assert_equal(cephes.kolmogorov(0),1.0)
273 274
@@ -428,9 +429,11 @@ def test_sindg(self):
428 429 assert_equal(cephes.sindg(90),1.0)
429 430 def test_smirnov(self):
430 431 assert_equal(cephes.smirnov(1,.1),0.9)
  432 + assert_(np.isnan(cephes.smirnov(1,np.nan)))
431 433 def test_smirnovi(self):
432 434 assert_almost_equal(cephes.smirnov(1,cephes.smirnovi(1,0.4)),0.4)
433 435 assert_almost_equal(cephes.smirnov(1,cephes.smirnovi(1,0.6)),0.6)
  436 + assert_(np.isnan(cephes.smirnovi(1,np.nan)))
434 437
435 438 def test_spence(self):
436 439 assert_equal(cephes.spence(1),0.0)

0 comments on commit 2858f45

Please sign in to comment.
Something went wrong with that request. Please try again.