code: def _ensure_float_array(arr: npt.ArrayLike) -> np.ndarray:
      arr = np.asarray(arr)
      if np.issubdtype(arr.dtype, np.integer):
          arr = arr.astype(float, copy=False)
      return arr
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Callable, Any, cast
  import numpy
  import numpy.typing
  import math
  import warnings
  from collections import namedtuple
  from scipy.special import roots_legendre
  from scipy.special import gammaln, logsumexp
  from scipy._lib._util import _rng_spawn
  from scipy._lib.deprecation import _NoValue, _deprecate_positional_args, _deprecated
label_desc: Use image node_id 17 for calling a global function with example usage: _ensure_float_array(arr) and returns: arr