\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -1.2963688795759268 \cdot 10^{64}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\mathbf{elif}\;b \le -2.2271387790640654 \cdot 10^{-160}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\mathbf{elif}\;b \le 7.7076257484328935 \cdot 10^{65}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\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 VAR;
if ((b <= -1.2963688795759268e+64)) {
VAR = (1.0 * ((c / b) - (b / a)));
} else {
double VAR_1;
if ((b <= -2.2271387790640654e-160)) {
VAR_1 = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
} else {
double VAR_2;
if ((b <= 7.7076257484328935e+65)) {
VAR_2 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
VAR_2 = (-1.0 * (c / b));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.2963688795759268e+64Initial program 39.9
Taylor expanded around -inf 5.1
Simplified5.1
if -1.2963688795759268e+64 < b < -2.2271387790640654e-160Initial program 5.7
if -2.2271387790640654e-160 < b < 7.7076257484328935e+65Initial program 28.1
rmApplied flip-+28.4
Simplified17.5
rmApplied div-inv17.5
rmApplied associate-*l/17.2
Simplified17.1
Taylor expanded around 0 11.1
if 7.7076257484328935e+65 < b Initial program 57.2
Taylor expanded around inf 3.6
Final simplification7.0
herbie shell --seed 2020092
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))