can we do binary search to solve quadratic equation? Suppose i have a quadratic equation like this, 2x^2 - 4x - 5 = 0, the solution here is x1=2.87 and x2=-0.87. I tried this python snippet to find the non-negative solution(2.87) by setting range 0 to 1000 and it worked but how to find the negative one too?. I tried the range -1000 to 0, but no luck!

def solve():
    low, high=0,1000 
    while (high-low)&gt;10e-5:
        x = (low+high)/2 
        fx = 2*(x**2)-4*x-5
        if fx&gt;0:
            high=x
        else:
            low=x

    return low

print(solve())


Or I am doing this whole thing wrong? What is the strategy to work with negative ranges and floating numbers in binary search?
Consider the value of fx on line 6.

def solve():
    low, high=-1000,0
    while (high-low)&gt;10e-5:
        x = (low+high)/2 
        fx = 2*(x**2)-4*x-5
        if fx&lt;0:
            high=x
        else:
            low=x

    return low

print(solve())


or

def solve():
    low, high=-1000,0
    while (high-low)&gt;10e-5:
        x = (low+high)/2 
        fx = 2*(x**2)-4*x-5
        if fx&gt;0:
            low=x
        else:
            high=x

    return low

print(solve())