A zero, x,
of a real-valued continuous function, f(x),
i.e., such that f(x)=0,
can be found by an application of the
binary search
algorithm.
Values ‘Lo’ and ‘Hi’
are chosen such that
(i) Lo<Hi, and
(ii) f(Lo)<0 and f(Hi)>0 or v.v..

Mid=(Lo+Hi)/2 and f(Mid) is computed.
If f(Mid) has the same sign as f(Lo)
then Lo is moved up to Mid.
If it has the same sign as f(Hi)
then Hi is moved down to Mid.
The algorithm terminates when Hi-Lo is "small".
It is not a good idea to wait until f(Mid)=0.

The HTML FORM below can be used to solve a cubic polynomial
(we'll ignore the fact that there are
better ways to solve cubics).
Change the coefficients of the powers of x
and click on the solve button to find a zero: