Permalink
Browse files

REF: add check that updating doesn't stop to prevent endless loops

  • Loading branch information...
1 parent 69e0bf2 commit 123a7dab7675e1a0c6c7e90df60467dd0443bf15 @josef-pkt committed Jan 3, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 scipy/stats/distributions.py
View
10 scipy/stats/distributions.py
@@ -5392,10 +5392,16 @@ def _drv2_ppfsingle(self, q, *args): # Use basic bisection algorithm
c = int((a+b)/2.0)
qc = self._cdf(c, *args)
if (qc < q):
- a = c
+ if a != c:
+ a = c
+ else:
+ raise RuntimeError('updating stopped, endless loop')
qa = qc
elif (qc > q):
- b = c
+ if b != c:
+ b = c
+ else:
+ raise RuntimeError('updating stopped, endless loop')
qb = qc
else:
return c

0 comments on commit 123a7da

Please sign in to comment.