class_docstr: Mixin class adding evalf capability.
class_docstr_tok: ["Mixin","class","adding","evalf","capability","."]
code: def _to_mpmath(self, prec, allow_ints=True):
      # mpmath functions accept ints as input
      errmsg = "cannot convert to mpmath number"
      if allow_ints and self.is_Integer:
          return self.p
      if hasattr(self, "_as_mpf_val"):
          return make_mpf(self._as_mpf_val(prec))
      try:
          result = evalf(self, prec, {})
          return quad_to_mpmath(result)
      except NotImplementedError:
          v = self._eval_evalf(prec)
          if v is None:
              raise ValueError(errmsg)
          if v.is_Float:
              return make_mpf(v._mpf_)
          # Number + Number*I is also fine
          re, im = v.as_real_imag()
          if allow_ints and re.is_Integer:
              re = from_int(re.p)
          elif re.is_Float:
              re = re._mpf_
          else:
              raise ValueError(errmsg)
          if allow_ints and im.is_Integer:
              im = from_int(im.p)
          elif im.is_Float:
              im = im._mpf_
          else:
              raise ValueError(errmsg)
          return make_mpc((re, im))
  
imports: from __future__ import annotations
  from typing import Tuple, Optional, Union, Callable, List, Dict, Type, TYPE_CHECKING, Any, overload
  import math
  import mpmath.libmp
  from mpmath import make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc, workprec
  from mpmath import inf
  from mpmath.libmp import from_int, from_man_exp, from_rational, fhalf, fnan, finf, fninf, fnone, fone, fzero, mpf_abs, mpf_add, mpf_atan, mpf_atan2, mpf_cmp, mpf_cos, mpf_e, mpf_exp, mpf_log, mpf_lt, mpf_mul, mpf_neg, mpf_pi, mpf_pow, mpf_pow_int, mpf_shift, mpf_sin, mpf_sqrt, normalize, round_nearest, to_int, to_str
  from mpmath.libmp import bitcount
  from mpmath.libmp.backend import MPZ
  from mpmath.libmp.libmpc import _infs_nan
  from mpmath.libmp.libmpf import dps_to_prec, prec_to_dps
  from .sympify import sympify
  from .singleton import S
  from sympy.external.gmpy import SYMPY_INTS
  from sympy.utilities.iterables import is_sequence
  from sympy.utilities.lambdify import lambdify
  from sympy.utilities.misc import as_int
label_desc: Use image node_id 4 for calling the EvalfMixin obj's underlying member method code with example usage: obj._to_mpmath(prec, allow_ints) and returns: self, make_mpf, quad_to_mpmath, make_mpc, make_mpf