code: def ensure_dtype_float(x, default=np.float64):
      r
      if isinstance(x, np.ndarray):
          if x.dtype.kind == 'f':
              return x
          elif x.dtype.kind == 'i':
              return x.astype(default)
          else:
              raise TypeError('x is of type '+str(x.dtype)+' that cannot be converted to float')
      else:
          raise TypeError('x is not an array')
docs: r"""Makes sure that x is type of float