def arange(
        cls,
        start: float | None = None,
        stop: float | None = None,
        step: float | None = None,
        *,
        coord_name: Hashable | None = None,
        dim: str,
        dtype: Any = None,
    ) -> "RangeIndex":
        """Create a new RangeIndex from given start, stop and step values.

        ``RangeIndex.arange`` can be called with a varying number of positional arguments:

        - ``RangeIndex.arange(stop)``: the index is within the half-open interval [0, stop)
          (in other words, the interval including start but excluding stop).

        - ``RangeIndex.arange(start, stop)``: the index is within the half-open interval
          [start, stop).

        - ``RangeIndex.arange(start, stop, step)``: the index is within the half-open interval
          [start, stop), with spacing between values given by step.

        .. note::
           When using a non-integer step, such as 0.1, it is often better to use
           :py:meth:`~xarray.indexes.RangeIndex.linspace`.

        .. note::
           ``RangeIndex.arange(start=4.0)`` returns a range index in the [0.0, 4.0)
           interval, i.e., ``start`` is interpreted as ``stop`` even when it is given
           as a unique keyword argument.

        Parameters
        ----------
        start : float, optional
            Start of interval. The interval includes this value. The default start
            value is 0. If ``stop`` is not given, the value given here is interpreted
            as the end of the interval.
        stop : float
            End of interval. In general the interval does not include this value,
            except floating point round-off affects the size of the dimension.
        step : float, optional
            Spacing between values (default: 1.0).
        coord_name : Hashable, optional
            Name of the (lazy) coordinate variable that will be created and
            associated with the new index. If ``None``, the coordinate is named
            as the dimension name.
        dim : str
            Dimension name.
        dtype : dtype, optional
            The dtype of the coordinate variable (default: float64).

        Examples
        --------
        >>> from xarray.indexes import RangeIndex

        >>> index = RangeIndex.arange(0.0, 1.0, 0.2, dim="x")
        >>> ds = xr.Dataset(coords=xr.Coordinates.from_xindex(index))

        >>> ds
        <xarray.Dataset> Size: 40B
        Dimensions:  (x: 5)
        Coordinates:
          * x        (x) float64 40B 0.0 0.2 0.4 0.6 0.8
        Data variables:
            *empty*
        Indexes:
            x        RangeIndex (start=0, stop=1, step=0.2)

        """
        if stop is None:
            if start is None:
                raise TypeError("RangeIndex.arange() requires stop to be specified")
            else:
                stop = start
                start = None
        if start is None:
            start = 0.0

        if step is None:
            step = 1.0

        if coord_name is None:
            coord_name = dim

        size = math.ceil((stop - start) / step)

        transform = RangeCoordinateTransform(
            start, stop, size, coord_name, dim, dtype=dtype
        )

        return cls(transform)
Create a new RangeIndex from given start, stop and step values.

        ``RangeIndex.arange`` can be called with a varying number of positional arguments:

        - ``RangeIndex.arange(stop)``: the index is within the half-open interval [0, stop)
          (in other words, the interval including start but excluding stop).

        - ``RangeIndex.arange(start, stop)``: the index is within the half-open interval
          [start, stop).

        - ``RangeIndex.arange(start, stop, step)``: the index is within the half-open interval
          [start, stop), with spacing between values given by step.

        .. note::
           When using a non-integer step, such as 0.1, it is often better to use
           :py:meth:`~xarray.indexes.RangeIndex.linspace`.

        .. note::
           ``RangeIndex.arange(start=4.0)`` returns a range index in the [0.0, 4.0)
           interval, i.e., ``start`` is interpreted as ``stop`` even when it is given
           as a unique keyword argument.

        Parameters
        ----------
        start : float, optional
            Start of interval. The interval includes this value. The default start
            value is 0. If ``stop`` is not given, the value given here is interpreted
            as the end of the interval.
        stop : float
            End of interval. In general the interval does not include this value,
            except floating point round-off affects the size of the dimension.
        step : float, optional
            Spacing between values (default: 1.0).
        coord_name : Hashable, optional
            Name of the (lazy) coordinate variable that will be created and
            associated with the new index. If ``None``, the coordinate is named
            as the dimension name.
        dim : str
            Dimension name.
        dtype : dtype, optional
            The dtype of the coordinate variable (default: float64).

        Examples
        --------
        >>> from xarray.indexes import RangeIndex

        >>> index = RangeIndex.arange(0.0, 1.0, 0.2, dim="x")
        >>> ds = xr.Dataset(coords=xr.Coordinates.from_xindex(index))

        >>> ds
        <xarray.Dataset> Size: 40B
        Dimensions:  (x: 5)
        Coordinates:
          * x        (x) float64 40B 0.0 0.2 0.4 0.6 0.8
        Data variables:
            *empty*
        Indexes:
            x        RangeIndex (start=0, stop=1, step=0.2)

        
xarray/indexes/range_index.py