more stable quadratic solver