def sign(x):
    """
    Returns the sign of the double number x.
    -1 if x < 0; 1 if x > 0 and 0 if x == 0
    """
    if x < 0:
        return -1
    elif x > 0:
        return 1
    else:
        return 0
