Solve a quadratic equation
Decide a: 2
Decide b: 6
Decide c: 2
The Quadratic equation for the results
Result for x: -0.381966
2.22045e-016
This actually looks reasonable. One of the roots of 2x2 + 6x + 2 is -0.381966.
I'm guessing your question is related to the second output. If we stick this number back into the equation, we get 2.22045e-016. Why isn't this 0? The reason is that we have small rounding errors whenever we deal with floating point numbers. The only way to avoid this is to represent a number with an infinite number of bits which is impossible. Most implementations use 64 bits for a double, so that's all of the precision that we get.
In the non-computer world, this would be similar to:
so we are very close, but not quite there because we didn't use an infinite number of digits to represent 1/3.
If you want to mask that, you can use setprecision() or std::fixed from iomanip. It won't change the actual value, but it'll hide these rounding errors when outputting.