\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 -3.4397859828859872 \cdot 10^{117}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\mathbf{elif}\;b \le -1.0621980184587312 \cdot 10^{-219}:\\
\;\;\;\;\frac{e^{\log \left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a}\\
\mathbf{elif}\;b \le 1.66563346804975556 \cdot 10^{146}:\\
\;\;\;\;\frac{\frac{1}{\frac{2}{4}} \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 <= -3.439785982885987e+117)) {
temp = (1.0 * ((c / b) - (b / a)));
} else {
double temp_1;
if ((b <= -1.0621980184587312e-219)) {
temp_1 = (exp(log((-b + sqrt(((b * b) - ((4.0 * a) * c)))))) / (2.0 * a));
} else {
double temp_2;
if ((b <= 1.6656334680497556e+146)) {
temp_2 = (((1.0 / (2.0 / 4.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 < -3.439785982885987e+117Initial program 51.7
Taylor expanded around -inf 2.9
Simplified2.9
if -3.439785982885987e+117 < b < -1.0621980184587312e-219Initial program 6.7
rmApplied add-exp-log10.5
if -1.0621980184587312e-219 < b < 1.6656334680497556e+146Initial program 32.0
rmApplied flip-+32.0
Simplified16.0
rmApplied clear-num16.2
Simplified15.0
rmApplied times-frac15.0
Simplified9.5
rmApplied associate-/r*9.1
Simplified9.0
if 1.6656334680497556e+146 < b Initial program 63.3
Taylor expanded around inf 1.8
Final simplification7.2
herbie shell --seed 2020049
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))