\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\end{array}\begin{array}{l}
\mathbf{if}\;b \le -6.8563483521743725 \cdot 10^{121}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}\\
\end{array}\\
\mathbf{elif}\;b \le 6.11692797249710472 \cdot 10^{145}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\\
\end{array}\\
\mathbf{elif}\;b \ge 0.0:\\
\;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\end{array}double code(double a, double b, double c) {
double temp;
if ((b >= 0.0)) {
temp = ((-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
} else {
temp = ((2.0 * c) / (-b + sqrt(((b * b) - ((4.0 * a) * c)))));
}
return temp;
}
double code(double a, double b, double c) {
double temp;
if ((b <= -6.8563483521743725e+121)) {
double temp_1;
if ((b >= 0.0)) {
temp_1 = ((-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
} else {
temp_1 = ((2.0 * c) / ((2.0 * ((a * c) / b)) - (2.0 * b)));
}
temp = temp_1;
} else {
double temp_2;
if ((b <= 6.116927972497105e+145)) {
double temp_3;
if ((b >= 0.0)) {
temp_3 = ((-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
} else {
temp_3 = ((2.0 * c) / (-b + ((cbrt(sqrt(((b * b) - ((4.0 * a) * c)))) * cbrt(sqrt(((b * b) - ((4.0 * a) * c))))) * cbrt(sqrt(((b * b) - ((4.0 * a) * c)))))));
}
temp_2 = temp_3;
} else {
double temp_4;
if ((b >= 0.0)) {
temp_4 = ((-b - b) / (2.0 * a));
} else {
temp_4 = ((2.0 * c) / (-b + sqrt(((b * b) - ((4.0 * a) * c)))));
}
temp_2 = temp_4;
}
temp = temp_2;
}
return temp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -6.8563483521743725e+121Initial program 31.8
Taylor expanded around -inf 6.0
if -6.8563483521743725e+121 < b < 6.116927972497105e+145Initial program 8.3
rmApplied add-cube-cbrt8.7
if 6.116927972497105e+145 < b Initial program 60.8
rmApplied add-exp-log61.1
rmApplied pow161.1
Applied log-pow61.1
Applied exp-prod61.1
Simplified61.1
Taylor expanded around inf 3.1
Final simplification7.4
herbie shell --seed 2020049 +o rules:numerics
(FPCore (a b c)
:name "jeff quadratic root 1"
:precision binary64
(if (>= b 0.0) (/ (- (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) (/ (* 2 c) (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))))))