code: def float_to_int(data, digits=None, dtype=np.int32):
      
      # convert to any numpy array
      data = np.asanyarray(data)
  
      # if data is already an integer or boolean we're done
      # if the data is empty we are also done
      if data.dtype.kind in 'ib' or data.size == 0:
          return data.astype(dtype)
  
      # populate digits from kwargs
      if digits is None:
          digits = util.decimal_to_digits(tol.merge)
      elif isinstance(digits, float) or isinstance(digits, np.float):
          digits = util.decimal_to_digits(digits)
      elif not (isinstance(digits, int) or isinstance(digits, np.integer)):
          log.warn('Digits were passed as %s!', digits.__class__.__name__)
          raise ValueError('Digits must be None, int, or float!')
  
      # data is float so convert to large integers
      data_max = np.abs(data).max() * 10**digits
      # ignore passed dtype if we have something large
      dtype = [np.int32, np.int64][int(data_max > 2**31)]
      # multiply by requested power of ten
      # then subtract small epsilon to avoid "go either way" rounding
      # then do the rounding and convert to integer
      as_int = np.round((data * 10 ** digits) - 1e-6).astype(dtype)
  
      return as_int
docs: Given a numpy array of float/bool/int, return as integers.
  
      Parameters
      -------------
      data :  (n, d) float, int, or bool
        Input data
      digits : float or int
        Precision for float conversion
      dtype : numpy.dtype
        What datatype should result be returned as
  
      Returns
      -------------
      as_int : (n, d) int
        Data as integers