\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}\begin{array}{l}
\mathbf{if}\;b \le -8.00336887744975224 \cdot 10^{118}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - e^{\log \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \le 1.96909460888896495 \cdot 10^{161}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \left|\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \ge 0.0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b - 2 \cdot \frac{a \cdot c}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}double code(double a, double b, double c) {
double temp;
if ((b >= 0.0)) {
temp = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
temp = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
return temp;
}
double code(double a, double b, double c) {
double temp;
if ((b <= -8.003368877449752e+118)) {
double temp_1;
if ((b >= 0.0)) {
temp_1 = ((2.0 * c) / (-b - exp(log(sqrt(((b * b) - ((4.0 * a) * c)))))));
} else {
temp_1 = (1.0 * ((c / b) - (b / a)));
}
temp = temp_1;
} else {
double temp_2;
if ((b <= 1.969094608888965e+161)) {
double temp_3;
if ((b >= 0.0)) {
temp_3 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
temp_3 = ((-b + (fabs(cbrt(((b * b) - ((4.0 * a) * c)))) * sqrt(cbrt(((b * b) - ((4.0 * a) * c)))))) / (2.0 * a));
}
temp_2 = temp_3;
} else {
double temp_4;
if ((b >= 0.0)) {
temp_4 = ((2.0 * c) / (-b - (b - (2.0 * ((a * c) / b)))));
} else {
temp_4 = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
temp_2 = temp_4;
}
temp = temp_2;
}
return temp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -8.003368877449752e+118Initial program 52.1
Taylor expanded around -inf 9.5
Taylor expanded around 0 2.9
Simplified2.9
rmApplied add-exp-log2.9
if -8.003368877449752e+118 < b < 1.969094608888965e+161Initial program 8.7
rmApplied add-cube-cbrt8.9
Applied sqrt-prod8.9
Simplified8.9
if 1.969094608888965e+161 < b Initial program 38.3
Taylor expanded around inf 6.2
Final simplification7.6
herbie shell --seed 2020049 +o rules:numerics
(FPCore (a b c)
:name "jeff quadratic root 2"
:precision binary64
(if (>= b 0.0) (/ (* 2 c) (- (- b) (sqrt (- (* b b) (* (* 4 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a))))