Solves a quadratic equation of the form ax² + bx + c = 0.
Returns roots as an array of objects: { real: number, imag: number }. Ensures no -0 values in results.
Coefficient of x²
Coefficient of x
Constant term
An array of two roots (real or complex)
solveQuadratic(1, 0, -4); // [{ real: 2, imag: 0 }, { real: -2, imag: 0 }]solveQuadratic(1, 0, 4); // [{ real: 0, imag: 2 }, { real: 0, imag: -2 }] Copy
solveQuadratic(1, 0, -4); // [{ real: 2, imag: 0 }, { real: -2, imag: 0 }]solveQuadratic(1, 0, 4); // [{ real: 0, imag: 2 }, { real: 0, imag: -2 }]
Solves a quadratic equation of the form ax² + bx + c = 0.
Returns roots as an array of objects: { real: number, imag: number }. Ensures no -0 values in results.