def reward_clipping(rew):
    """
    Sets positive rewards to +1 and negative rewards to -1.

    Args:
        rew: A scalar reward signal.

    Returns:
        +1. if the scalar is positive, -1. if is negative and 0 otherwise.
    """
    if rew > 0:
        return 1.
    if rew < 0:
        return -1.
    return 0.