\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.47669586871183219 \cdot 10^{89}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{1}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \le 7.0423614716856544 \cdot 10^{82}:\\
\;\;\;\;\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|\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:\\
\;\;\;\;-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 <= -1.4766958687118322e+89)) {
double VAR_1;
if ((b >= 0.0)) {
VAR_1 = (1.0 / ((-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * c)));
} else {
VAR_1 = (1.0 * ((c / b) - (b / a)));
}
VAR = VAR_1;
} else {
double VAR_2;
if ((b <= 7.042361471685654e+82)) {
double VAR_3;
if ((b >= 0.0)) {
VAR_3 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
VAR_3 = ((-b + (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 = (-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 < -1.4766958687118322e+89Initial program 43.9
Taylor expanded around -inf 9.4
Taylor expanded around 0 4.2
Simplified4.2
rmApplied clear-num4.2
if -1.4766958687118322e+89 < b < 7.042361471685654e+82Initial program 8.9
rmApplied add-cube-cbrt9.1
Applied sqrt-prod9.1
Simplified9.1
if 7.042361471685654e+82 < b Initial program 27.3
Taylor expanded around -inf 27.3
Taylor expanded around 0 27.3
Simplified27.3
rmApplied clear-num27.5
Taylor expanded around inf 3.0
Final simplification6.8
herbie shell --seed 2020079
(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))))