\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 -2.7508333903592313 \cdot 10^{127}:\\
\;\;\;\;\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 6.3659710098836927 \cdot 10^{102}:\\
\;\;\;\;\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{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\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}{2 \cdot \frac{a \cdot c}{b} - 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 VAR;
if ((b >= 0.0)) {
VAR = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
VAR = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
return VAR;
}
double code(double a, double b, double c) {
double VAR;
if ((b <= -2.7508333903592313e+127)) {
double VAR_1;
if ((b >= 0.0)) {
VAR_1 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
VAR_1 = (((2.0 * ((a * c) / b)) - (2.0 * b)) / (2.0 * a));
}
VAR = VAR_1;
} else {
double VAR_2;
if ((b <= 6.365971009883693e+102)) {
double VAR_3;
if ((b >= 0.0)) {
VAR_3 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
VAR_3 = ((-b + (sqrt(sqrt(((b * b) - ((4.0 * a) * c)))) * sqrt((fabs(cbrt(((b * b) - ((4.0 * a) * c)))) * sqrt(cbrt(((b * b) - ((4.0 * a) * c)))))))) / (2.0 * a));
}
VAR_2 = VAR_3;
} else {
double VAR_4;
if ((b >= 0.0)) {
VAR_4 = ((2.0 * c) / ((2.0 * ((a * c) / b)) - (2.0 * b)));
} else {
VAR_4 = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
VAR_2 = VAR_4;
}
VAR = VAR_2;
}
return VAR;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.7508333903592313e+127Initial program 55.5
rmApplied add-sqr-sqrt55.5
Applied sqrt-prod55.5
Taylor expanded around -inf 10.3
if -2.7508333903592313e+127 < b < 6.365971009883693e+102Initial program 8.6
rmApplied add-sqr-sqrt8.6
Applied sqrt-prod8.8
rmApplied add-cube-cbrt8.8
Applied sqrt-prod8.8
Simplified8.8
if 6.365971009883693e+102 < b Initial program 30.6
Taylor expanded around inf 6.4
Final simplification8.4
herbie shell --seed 2020078
(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))))