\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \le -180.886209626466126:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(b, b, -\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \frac{c}{1}}{\frac{2 \cdot a}{-a} \cdot \left(-b\right)}\\
\end{array}double code(double a, double b, double c) {
return ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
double code(double a, double b, double c) {
double temp;
if ((((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)) <= -180.88620962646613)) {
temp = ((fma(b, b, -((b * b) - ((4.0 * a) * c))) / (-b - sqrt(((b * b) - ((4.0 * a) * c))))) / (2.0 * a));
} else {
temp = ((-2.0 * (c / 1.0)) / (((2.0 * a) / -a) * -b));
}
return temp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) < -180.88620962646613Initial program 18.3
rmApplied flip-+18.3
Simplified17.6
if -180.88620962646613 < (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) Initial program 46.7
Taylor expanded around inf 10.1
rmApplied *-un-lft-identity10.1
Applied *-commutative10.1
Applied times-frac10.1
Applied associate-*r*10.1
Applied associate-/l*9.9
rmApplied frac-2neg9.9
Applied associate-/r/9.9
Final simplification10.6
herbie shell --seed 2020066 +o rules:numerics
(FPCore (a b c)
:name "Quadratic roots, medium range"
:precision binary64
:pre (and (< 1.11022e-16 a 9.0072e+15) (< 1.11022e-16 b 9.0072e+15) (< 1.11022e-16 c 9.0072e+15))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))