\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 -4.72518951228215428 \cdot 10^{173}:\\
\;\;\;\;\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{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \le 1.7848646122762274 \cdot 10^{65}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{2 \cdot c}{\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}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{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}{2 \cdot \left(\frac{a}{\sqrt[3]{b} \cdot \sqrt[3]{b}} \cdot \frac{c}{\sqrt[3]{b}}\right) - 2 \cdot b}\\
\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 <= -4.7251895122821543e+173)) {
double temp_1;
if ((b >= 0.0)) {
temp_1 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
temp_1 = (((2.0 * ((a * c) / b)) - (2.0 * b)) / (2.0 * a));
}
temp = temp_1;
} else {
double temp_2;
if ((b <= 1.7848646122762274e+65)) {
double temp_3;
if ((b >= 0.0)) {
temp_3 = ((2.0 * c) / (-b - (fabs(cbrt(((b * b) - ((4.0 * a) * c)))) * sqrt(cbrt(((b * b) - ((4.0 * a) * c)))))));
} else {
temp_3 = ((-b + sqrt(((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) / ((2.0 * ((a / (cbrt(b) * cbrt(b))) * (c / cbrt(b)))) - (2.0 * 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 < -4.7251895122821543e+173Initial program 64.0
Taylor expanded around -inf 12.1
if -4.7251895122821543e+173 < b < 1.7848646122762274e+65Initial program 10.1
rmApplied add-cube-cbrt10.3
Applied sqrt-prod10.3
Simplified10.3
if 1.7848646122762274e+65 < b Initial program 26.2
Taylor expanded around inf 7.1
rmApplied add-cube-cbrt7.1
Applied times-frac3.1
Final simplification8.5
herbie shell --seed 2020053
(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))))