def nextpow2(n):
    """Find :math:`p` that satisfies :math:`2^p \\ge |n|`.

    Parameters
    ----------
    n : int or float

    Returns
    -------
    p : int
        the power of 2 satisfying :math:`2^p \\ge |n|`.

    """
    p = 0
    pow2 = 2 ** p
    while pow2 < abs(n):
        p = p + 1
        pow2 = 2 ** p
    return p
