class_docstr: Abstract base class for rounding functions.
class_docstr_tok: ["Abstract","base","class","for","rounding","functions","."]
code: def eval(cls, arg):
      v = cls._eval_number(arg)
      if v is not None:
          return v
  
      if arg.is_integer or arg.is_finite is False:
          return arg
      if arg.is_imaginary or (S.ImaginaryUnit * arg).is_real:
          i = im(arg)
          if not i.has(S.ImaginaryUnit):
              return cls(i) * S.ImaginaryUnit
          return cls(arg, evaluate=False)
  
      # Integral, numerical, symbolic part
      ipart = npart = spart = S.Zero
  
      # Extract integral (or complex integral) terms
      intof = (
          lambda x: int(x)
          if int_valued(x)
          else (x if x.is_integer else None)
      )
      for t in Add.make_args(arg):
          if t.is_imaginary and (i := intof(im(t))) is not None:
              ipart += i * S.ImaginaryUnit
          elif (i := intof(t)) is not None:
              ipart += i
          elif t.is_number:
              npart += t
          else:
              spart += t
  
      if not (npart or spart):
          return ipart
  
      # Evaluate npart numerically if independent of spart
      if npart and (
          not spart
          or npart.is_real
          and (spart.is_imaginary or (S.ImaginaryUnit * spart).is_real)
          or npart.is_imaginary
          and spart.is_real
      ):
          try:
              r, i = get_integer_part(
                  npart, cls._dir, {}, return_ints=True
              )
              ipart += Integer(r) + Integer(i) * S.ImaginaryUnit
              npart = S.Zero
          except (PrecisionExhausted, NotImplementedError):
              pass
  
      spart += npart
      if not spart:
          return ipart
      elif spart.is_imaginary or (S.ImaginaryUnit * spart).is_real:
          return (
              ipart + cls(im(spart), evaluate=False) * S.ImaginaryUnit
          )
      elif isinstance(spart, (floor, ceiling)):
          return ipart + spart
      else:
          return ipart + cls(spart, evaluate=False)
  
imports: from typing import Tuple
  from sympy.core.basic import Basic
  from sympy.core.expr import Expr
  from sympy.core import Add, S
  from sympy.core.evalf import get_integer_part, PrecisionExhausted
  from sympy.core.function import Function
  from sympy.core.logic import fuzzy_or
  from sympy.core.numbers import Integer, int_valued
  from sympy.core.relational import Gt, Lt, Ge, Le, Relational, is_eq
  from sympy.core.sympify import _sympify
  from sympy.functions.elementary.complexes import im, re
  from sympy.multipledispatch import dispatch
label_desc: Use image node_id 1 for calling the RoundFunction obj's underlying member method code with example usage: obj.eval(cls, arg) and returns: v, arg, cls, ipart, ipart, unknown, unknown, unknown, unknown