\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 -1.27967585422245466 \cdot 10^{154}:\\
\;\;\;\;\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 1.58777332042805171 \cdot 10^{66}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{\left(-b\right) - \left|\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}\right| \cdot \sqrt{\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}}}}{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}\\
\mathbf{elif}\;b \ge 0.0:\\
\;\;\;\;\frac{2 \cdot \frac{a \cdot c}{b} - 2 \cdot 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 VAR;
if ((b >= 0.0)) {
VAR = ((-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
} else {
VAR = ((2.0 * c) / (-b + sqrt(((b * b) - ((4.0 * a) * c)))));
}
return VAR;
}
double code(double a, double b, double c) {
double VAR;
if ((b <= -1.2796758542224547e+154)) {
double VAR_1;
if ((b >= 0.0)) {
VAR_1 = ((-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
} else {
VAR_1 = ((2.0 * c) / ((2.0 * ((a * c) / b)) - (2.0 * b)));
}
VAR = VAR_1;
} else {
double VAR_2;
if ((b <= 1.5877733204280517e+66)) {
double VAR_3;
if ((b >= 0.0)) {
VAR_3 = ((-b - (fabs(cbrt(((b * b) - ((4.0 * a) * c)))) * sqrt((cbrt(sqrt(((b * b) - ((4.0 * a) * c)))) * cbrt(sqrt(((b * b) - ((4.0 * a) * c)))))))) / (2.0 * a));
} else {
VAR_3 = ((2.0 * c) / (-b + sqrt(((b * b) - ((4.0 * a) * c)))));
}
VAR_2 = VAR_3;
} else {
double VAR_4;
if ((b >= 0.0)) {
VAR_4 = (((2.0 * ((a * c) / b)) - (2.0 * b)) / (2.0 * a));
} else {
VAR_4 = ((2.0 * c) / (-b + sqrt(((b * b) - ((4.0 * a) * c)))));
}
VAR_2 = VAR_4;
}
VAR = VAR_2;
}
return VAR;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.2796758542224547e+154Initial program 38.6
Taylor expanded around -inf 6.6
if -1.2796758542224547e+154 < b < 1.5877733204280517e+66Initial program 8.5
rmApplied add-cube-cbrt8.7
Applied sqrt-prod8.7
Simplified8.7
rmApplied add-sqr-sqrt8.7
Applied cbrt-prod8.7
if 1.5877733204280517e+66 < b Initial program 39.7
Taylor expanded around inf 10.2
Final simplification8.6
herbie shell --seed 2020092
(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)))))))