def amp_clamp(val):

    """
    Clamps an incoming value to either -1 or 1.

    :param val: Value to clamp
    :type val: float
    :return: Clamped value
    :rtype: float
    """

    if val > 1.0:

        # Too big, clamp it

        return 1.0

    if val < -1.0:

        # Too small, clamp it

        return -1.0

    # No changes necessary

    return val