\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.9192954050062855 \cdot 10^{96}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{2}{\frac{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{c}}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \le 1.7007433694472029 \cdot 10^{75}:\\
\;\;\;\;\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{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \ge 0.0:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\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 <= -8.919295405006286e+96)) {
double VAR_1;
if ((b >= 0.0)) {
VAR_1 = (2.0 / (((2.0 * ((a * c) / b)) - (2.0 * b)) / c));
} else {
VAR_1 = (1.0 * ((c / b) - (b / a)));
}
VAR = VAR_1;
} else {
double VAR_2;
if ((b <= 1.700743369447203e+75)) {
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(sqrt(((b * b) - ((4.0 * a) * c)))))) / (2.0 * a));
}
VAR_2 = VAR_3;
} else {
double VAR_4;
if ((b >= 0.0)) {
VAR_4 = (-1.0 * (c / b));
} else {
VAR_4 = (1.0 * ((c / b) - (b / 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 < -8.919295405006286e+96Initial program 43.9
Taylor expanded around -inf 9.5
Taylor expanded around 0 3.3
Simplified3.3
rmApplied associate-/l*3.3
Taylor expanded around inf 3.3
if -8.919295405006286e+96 < b < 1.700743369447203e+75Initial program 9.0
rmApplied add-sqr-sqrt9.0
Applied sqrt-prod9.1
if 1.700743369447203e+75 < b Initial program 26.4
Taylor expanded around -inf 26.4
Taylor expanded around 0 26.4
Simplified26.4
rmApplied associate-/l*26.7
Taylor expanded around inf 3.4
Final simplification6.7
herbie shell --seed 2020091 +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))))