def rect(x: float) ->float:
    """
    The rect function defined as:

        * 1 for -½ ≤ x ≤ ½
        * 0 otherwise.

    .. image:: /figures/rect.*

    """
    return 1.0 if abs(x) <= 0.5 else 0.0
