You are performing lots of math on int
variables, and storing the result in float
. That does not mean that the arithmetic is performed using floating point, it will all be integer.
The sqrt()
function returns double
, so that saves the imaginary part. For the real part, all the math is integer, so -(b / (2 * a))
will be evaluated using integers and then the final result will be stored in x
as a float, of course without ever having any fractional part.