Skip to content

Commit

Permalink
Implemented recursive calling in _eval_evalf()
Browse files Browse the repository at this point in the history
Fixes sympy#12092 .

Enabled recursive calling of the evalf() function.

Tests are added.
  • Loading branch information
arihantparsoya committed Feb 7, 2017
1 parent d7c3045 commit 414abfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sympy/core/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def _eval_evalf(self, prec):
func = getattr(mpmath, fname)
except (AttributeError, KeyError):
try:
return Float(self._imp_(*self.args), prec)
return Float(self._imp_(*[i.evalf(prec) for i in self.args]), prec)
except (AttributeError, TypeError, ValueError):
return

Expand Down
3 changes: 3 additions & 0 deletions sympy/utilities/tests/test_lambdify.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ def test_issue_2790():
assert lambdify((x, (y, (w, z))), w + x + y + z)(1, (2, (3, 4))) == 10
assert lambdify(x, x + 1, dummify=False)(1) == 2

def test_issue_12092():
f = implemented_function('f', lambda x: x**2)
assert f(f(2)).evalf() == Float(16)

def test_ITE():
assert lambdify((x, y, z), ITE(x, y, z))(True, 5, 3) == 5
Expand Down

0 comments on commit 414abfc

Please sign in to comment.