import mpmath


def sf(x, loc=0, scale=1):
    """
    Survival function of the logistic distribution.
    """
    with mpmath.extradps(5):
        x = mpmath.mpf(x)
        loc = mpmath.mpf(loc)
        scale = mpmath.mpf(scale)
        z = (x - loc) / scale
        p = (1 - mpmath.tanh(z/2)) / 2
    return p