Solving quadratic equations with complex roots