Skip to content

Commit

Permalink
Merge pull request scipy#5420 from zaz/patch-2
Browse files Browse the repository at this point in the history
Raise proper error if maxiter < 1
  • Loading branch information
dlax committed Oct 25, 2015
2 parents 2dd1cdc + 9023b5a commit 491530e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scipy/optimize/zeros.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def newton(func, x0, fprime=None, args=(), tol=1.48e-8, maxiter=50,
"""
if tol <= 0:
raise ValueError("tol too small (%g <= 0)" % tol)
if maxiter < 1:
raise ValueError("maxiter must be greater than 0")
if fprime is not None:
# Newton-Rapheson method
# Multiply by 1.0 to convert to floating point. We don't use float(x0)
Expand Down

0 comments on commit 491530e

Please sign in to comment.