\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 -1.2963688795759268 \cdot 10^{64}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;-2 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \le -5.29732040469412883 \cdot 10^{-303}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{2 \cdot c}{\frac{\left(4 \cdot a\right) \cdot c}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}}\\
\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 \le 4.06558065692208167 \cdot 10^{64}:\\
\;\;\;\;\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{\frac{\left(4 \cdot a\right) \cdot c}{\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 \frac{a \cdot c}{b} - 2 \cdot 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 <= -1.2963688795759268e+64)) {
double VAR_1;
if ((b >= 0.0)) {
VAR_1 = (-2.0 * (c / b));
} else {
VAR_1 = (1.0 * ((c / b) - (b / a)));
}
VAR = VAR_1;
} else {
double VAR_2;
if ((b <= -5.297320404694129e-303)) {
double VAR_3;
if ((b >= 0.0)) {
VAR_3 = ((2.0 * c) / (((4.0 * a) * c) / (sqrt(((b * b) - ((4.0 * a) * c))) - b)));
} else {
VAR_3 = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
VAR_2 = VAR_3;
} else {
double VAR_4;
if ((b <= 4.0655806569220817e+64)) {
double VAR_5;
if ((b >= 0.0)) {
VAR_5 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
VAR_5 = ((((4.0 * a) * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c))))) / (2.0 * a));
}
VAR_4 = VAR_5;
} else {
double VAR_6;
if ((b >= 0.0)) {
VAR_6 = ((2.0 * c) / ((2.0 * ((a * c) / b)) - (2.0 * b)));
} else {
VAR_6 = (1.0 * ((c / b) - (b / a)));
}
VAR_4 = VAR_6;
}
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.2963688795759268e+64Initial program 39.9
Taylor expanded around -inf 10.7
Taylor expanded around 0 5.1
Simplified5.1
Taylor expanded around inf 5.1
if -1.2963688795759268e+64 < b < -5.297320404694129e-303Initial program 9.4
rmApplied flip--9.4
Simplified9.4
Simplified9.4
if -5.297320404694129e-303 < b < 4.0655806569220817e+64Initial program 8.9
rmApplied flip-+8.9
Simplified8.9
if 4.0655806569220817e+64 < b Initial program 27.1
Taylor expanded around -inf 27.1
Taylor expanded around 0 27.1
Simplified27.1
Taylor expanded around inf 6.9
Final simplification7.8
herbie shell --seed 2020092
(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))))