function p = bisectionbuggy(f, a, b, tol)
    while 1
        p = (a+b)/2;
        if p - a < tol 
            break; 
        end
        if f(b)*f(p) > 0
            a = p;
        else
            b = p;
        end
    end
end

