For large degree polynomials (>=5) with real coefficients, the only general root-finding algorithms are approximate. Since polynomials might have complex roots, any algorithm for finding the real roots of a polynomial must apply an approximate root-finding algorithm, then filter the results to obtain only real solutions.
A naive algorithm for filtering the results for real solutions, by simply checking that the imaginary part is identical to 0:
Filter Algorithm 1:
\begin{align*} \text{complex}(x) = \begin{cases} \text{True} & \text{imag}(x) = 0, \\ \text{False}& \text{else} \end{cases} \end{align*}
Is insufficient, since, due to the approximate nature of the initial root-finding, real solutions are not guaranteed to have imaginary parts that are identical to 0.
One possibility is to apply a "tolerance" to check that the imaginary part is not above a certain threshold. However, complex roots may have small imaginary parts, and this risks identifying actual complex roots as real ones.
Another possibility may be to check to see if the complex conjugate of a particular root is also a root, but, since we have already narrowed our search to approximate roots with small imaginary parts, then this will not help separate real roots from complex ones.
How can we determine with higher precision if a particular approximate root is "truly" a complex root, or is actually a real root with a floating-point error imaginary part?