result = from_sympy(result)
// evaluate leaves to convert e.g. Plus[2, I] -> Complex[2, 1]
result = result.evaluate_leaves(evaluation)
elif mpmath_function is not None:
prec = min_prec(*args)
with mpmath.workprec(prec):
sympy_args = [x.to_sympy() for x in args]
if None in sympy_args:
return
mpmath_args = [sympy2mpmath(x, prec) for x in sympy_args]
if None in mpmath_args:
return
try:
result = self.get_mpmath_function(mpmath_args)(*mpmath_args)
result = from_sympy(mpmath2sympy(result, prec))
except ValueError as exc:
text = str(exc)
if text == "gamma function pole":
return Symbol("ComplexInfinity")
else:
raise
except ZeroDivisionError:
return
After Change
return
result = self.call_mpmath(mpmath_function, float_args)
if isinstance(result, (mpmath.mpc, mpmath.mpf)):
result = Number.from_mp(result)
else:
prec = min_prec(*args)