\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:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - {\left(e^{\sqrt[3]{\log \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \cdot \sqrt[3]{\log \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\right)}^{\left(\sqrt[3]{\log \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}\right)}}\\
\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}{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}\\
\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{\mathsf{fma}\left(b, b, -\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right)}{\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}:\\
\;\;\;\;\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 <= -1.2963688795759268e+64)) {
double VAR_1;
if ((b >= 0.0)) {
VAR_1 = ((2.0 * c) / (-b - pow(exp((cbrt(log(sqrt(((b * b) - ((4.0 * a) * c))))) * cbrt(log(sqrt(((b * b) - ((4.0 * a) * c))))))), cbrt(log(sqrt(((b * b) - ((4.0 * a) * c))))))));
} 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) / ((2.0 * ((a * c) / b)) - (2.0 * 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 = ((fma(b, b, -((b * b) - ((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 = ((-b + sqrt(((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 < -1.2963688795759268e+64Initial program 39.9
Taylor expanded around -inf 10.7
Taylor expanded around 0 5.1
Simplified5.1
rmApplied add-exp-log5.1
rmApplied add-cube-cbrt5.1
Applied exp-prod5.1
if -1.2963688795759268e+64 < b < -5.297320404694129e-303 or 4.0655806569220817e+64 < b Initial program 18.2
Taylor expanded around inf 8.2
if -5.297320404694129e-303 < b < 4.0655806569220817e+64Initial program 8.9
rmApplied flip-+8.9
Simplified8.9
Final simplification7.8
herbie shell --seed 2020092 +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))))