I'm working on a program to program the bisection method: https://www.calculushowto.com/bisection-method/
I know there's questions similar to this one but I want to see if my own one works.
double func(double x) {
    return x * x - 3 * x - 1;
}
    
double bisect(double (*f)(double), double a, double b, double e) {
    double mid = (a + b) / 2;
    while (abs(mid) > e) {
        if (f(mid) < 0) {
            mid = a;
        } else {
            mid = b;
        }
    }
      
    return mid;       
}
func() is the function I'm using to test the bisection method. In the other function, a is the left point, b is the right point and e is the error bound.
Any mistakes that I didn't catch?
 
     
    