Skip to content

Commit

Permalink
Update root_finding.py (#560)
Browse files Browse the repository at this point in the history
when x0 >= 0, q0 is not initially assigned, but since this function is jitted, I believe q0 = 0.0 when referenced before assignment

to notice the error, remove @njit decorator and set x0 >= 0
  • Loading branch information
alanlujan91 committed Dec 22, 2020
1 parent 805650a commit 08a15f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion quantecon/optimize/root_finding.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def newton_secant(func, x0, args=(), tol=1.48e-8, maxiter=50,
p1 = x0 * (1 + 1e-4) + 1e-4
else:
p1 = x0 * (1 + 1e-4) - 1e-4
q0 = func(p0, *args)
q0 = func(p0, *args)
funcalls += 1
q1 = func(p1, *args)
funcalls += 1
Expand Down

0 comments on commit 08a15f5

Please sign in to comment.