import mpmath


def invcdf(p, mu=0, b=1):
    """
    Laplace distribution inverse CDF.

    This function is also known as the quantile function or the percent
    point function.
    """
    if b <= 0:
        raise ValueError('b must be positive.')
    with mpmath.extradps(5):
        p = mpmath.mpf(p)
        mu = mpmath.mpf(mu)
        b = mpmath.mpf(b)
        if p <= 0.5:
            q = mu + b*mpmath.log(2*p)
        else:
            q = mu - b*mpmath.log(2 - 2*p)
        return q