\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 -5.7956926409099789 \cdot 10^{153}:\\
\;\;\;\;\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) + \left(2 \cdot \frac{a \cdot c}{b} - b\right)}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \le 4.591188790043355 \cdot 10^{-310}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;c \cdot \frac{2}{\left(-b\right) - \left(b - 2 \cdot \frac{c}{\frac{b}{a}}\right)}\\
\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 6.78594296272638531 \cdot 10^{101}:\\
\;\;\;\;\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) + \left(2 \cdot \frac{a \cdot c}{b} - b\right)}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \ge 0.0:\\
\;\;\;\;\frac{c}{\frac{\left(-b\right) - \left(b - 2 \cdot \frac{c}{\frac{b}{a}}\right)}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \frac{\sqrt{{\left(b \cdot b\right)}^{3} - {\left(\left(4 \cdot a\right) \cdot c\right)}^{3}}}{\sqrt{\left(b \cdot b\right) \cdot \left(b \cdot b\right) + \left(\left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right) + \left(b \cdot b\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)\right)}}}{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 <= -5.795692640909979e+153)) {
double VAR_1;
if ((b >= 0.0)) {
VAR_1 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
VAR_1 = ((-b + ((2.0 * ((a * c) / b)) - b)) / (2.0 * a));
}
VAR = VAR_1;
} else {
double VAR_2;
if ((b <= 4.59118879004335e-310)) {
double VAR_3;
if ((b >= 0.0)) {
VAR_3 = (c * (2.0 / (-b - (b - (2.0 * (c / (b / a)))))));
} else {
VAR_3 = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
VAR_2 = VAR_3;
} else {
double VAR_4;
if ((b <= 6.785942962726385e+101)) {
double VAR_5;
if ((b >= 0.0)) {
VAR_5 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
VAR_5 = ((-b + ((2.0 * ((a * c) / b)) - b)) / (2.0 * a));
}
VAR_4 = VAR_5;
} else {
double VAR_6;
if ((b >= 0.0)) {
VAR_6 = (c / ((-b - (b - (2.0 * (c / (b / a))))) / 2.0));
} else {
VAR_6 = ((-b + (sqrt((pow((b * b), 3.0) - pow(((4.0 * a) * c), 3.0))) / sqrt((((b * b) * (b * b)) + ((((4.0 * a) * c) * ((4.0 * a) * c)) + ((b * b) * ((4.0 * a) * c))))))) / (2.0 * 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 < -5.795692640909979e+153 or 4.59118879004335e-310 < b < 6.785942962726385e+101Initial program 23.2
Taylor expanded around -inf 9.6
if -5.795692640909979e+153 < b < 4.59118879004335e-310Initial program 8.0
Taylor expanded around inf 8.0
rmApplied *-commutative8.0
Applied associate-/l*8.0
rmApplied *-commutative8.0
Applied associate-/l*8.0
rmApplied clear-num8.0
Applied associate-/r/8.0
Simplified8.0
if 6.785942962726385e+101 < b Initial program 30.5
Taylor expanded around inf 6.3
rmApplied *-commutative6.3
Applied associate-/l*2.3
rmApplied *-commutative2.3
Applied associate-/l*2.3
rmApplied flip3--2.3
Applied sqrt-div2.3
Final simplification7.3
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))))