code: def check_binary(self, xp):
      arg1 = self.arg1
      arg2 = self.arg2
      np1 = numpy.asarray(arg1)
      np2 = numpy.asarray(arg2)
      dtype1 = np1.dtype
      dtype2 = np2.dtype
  
      if self.name == "power" or self.name == "float_power":
          # TODO(niboshi): Fix this: power(0, 1j)
          #     numpy => 1+0j
          #     cupy => 0j
          if dtype2 in complex_types and (np1 == 0).any():
              return xp.array(True)
  
      # TODO(niboshi): Fix this: xp.add(0j, xp.array([2.], 'f')).dtype
      #     numpy => complex64
      #     cupy => complex128
      if isinstance(arg1, complex):
          if dtype2 in (numpy.float16, numpy.float32):
              return xp.array(True)
  
      if isinstance(arg1, numpy.ndarray):
          arg1 = xp.asarray(arg1)
      if isinstance(arg2, numpy.ndarray):
          arg2 = xp.asarray(arg2)
  
      # Subtraction between booleans is not allowed.
      if (
          self.name == "subtract"
          and dtype1 == numpy.bool_
          and dtype2 == numpy.bool_
      ):
          return xp.array(True)
  
      func = getattr(xp, self.name)
      with numpy.errstate(divide="ignore"):
          with warnings.catch_warnings():
              warnings.filterwarnings("ignore")
              if self.use_dtype:
                  y = func(arg1, arg2, dtype=self.dtype)
              else:
                  y = func(arg1, arg2)
  
      # TODO(niboshi): Fix this. If rhs is a Python complex,
      #    numpy returns complex64
      #    cupy returns complex128
      if (
          xp is cupy
          and isinstance(arg2, complex)
          and self.name != "float_power"
      ):
          if dtype1 in (numpy.float16, numpy.float32):
              y = y.astype(numpy.complex64)
  
      # NumPy returns different values (nan/inf) on division by zero
      # depending on the architecture.
      # As it is not possible for CuPy to replicate this behavior, we ignore
      # the difference here.
      if self.name in ("floor_divide", "remainder"):
          if (
              y.dtype in (float_types + complex_types)
              and (np2 == 0).any()
          ):
              y = xp.asarray(y)
              y[y == numpy.inf] = numpy.nan
              y[y == -numpy.inf] = numpy.nan
  
      return y
  
imports: import itertools
  import warnings
  import numpy
  import pytest
  import cupy
  from cupy import testing
label_desc: Use image node_id 1 for calling the ArithmeticBinaryBase obj's underlying member method code with example usage: obj.check_binary(xp) and returns: y, xp, xp, xp