We all know that on $\mathbb{R}$ the solution of a second degree equation in the form $Ax^2 + Bx + C$ is given by:
\begin{equation} \frac{-B \pm \sqrt{B^2 - 4AC}}{2A} \end{equation}
Now, be $A, B, C \in \mathbb{Z}$. I want to find $x \in \mathbb{Z}$ so that
\begin{equation} x = \min(\{y \in \mathbb{Z} / (A y^2 + By + C \leq 0)\}) \end{equation}
How can I get the solution to this equation by using only integer operators (so integer part for division) and having already the function $isqrt(x) = \min(\{y \in \mathbb{Z} / y^2 \leq x\})$?
I tried blindly using the formula above by substituting all the real operations with integer operations but that didn't seem to work.
As I see it this method should work fine as long as $A>0$.
The product, squaring and subtraction that go on inside the square root are all unaffected by the fact that integer operations are used, because the variables are all integers to start with. The square root function will yield a value that has error $e<1$.
This negative square root is added to $-B$ with no increase of error.
The dividing should reduce the error to $\frac e {2A}$.