def _alternating_signs(n):
    """
        Return 1 if n is zero
        Returns -1 if n is odd
        Returns 1 if n is even
    """

    if (n < 0.0):
        raise ValueError("Argument has to be zero or a positive integer")

    return (-1.0)**n