\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 -7.70031330541463201 \cdot 10^{138}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\mathbf{elif}\;b \le -3.95103770532986732 \cdot 10^{-253}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\mathbf{elif}\;b \le 4.18338381295531773 \cdot 10^{98}:\\
\;\;\;\;\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 temp;
if ((b <= -7.700313305414632e+138)) {
temp = (1.0 * ((c / b) - (b / a)));
} else {
double temp_1;
if ((b <= -3.9510377053298673e-253)) {
temp_1 = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
} else {
double temp_2;
if ((b <= 4.183383812955318e+98)) {
temp_2 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
temp_2 = (-1.0 * (c / b));
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -7.700313305414632e+138Initial program 57.3
Taylor expanded around -inf 2.9
Simplified2.9
if -7.700313305414632e+138 < b < -3.9510377053298673e-253Initial program 8.0
if -3.9510377053298673e-253 < b < 4.183383812955318e+98Initial program 29.8
rmApplied clear-num29.9
rmApplied flip-+29.9
Applied associate-/r/30.0
Applied associate-/r*30.0
Simplified15.8
Taylor expanded around 0 9.8
if 4.183383812955318e+98 < b Initial program 59.5
Taylor expanded around inf 2.8
Final simplification6.7
herbie shell --seed 2020065
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))