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
except SpecialValueError as exc:
return Symbol(exc.name)
return result
After Change
elif mpmath_function is None:
return
if any(arg.is_machine_precision() for arg in args):
// if any argument has machine precision then the entire calculation
// is done with machine precision.
float_args = [arg.get_float_value(n_evaluation=evaluation, permit_complex=True) for arg in args]