\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.60486965427693535 \cdot 10^{63}:\\
\;\;\;\;\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 7.58741178983434122 \cdot 10^{119}:\\
\;\;\;\;\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{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\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 \left(a \cdot \frac{c}{b}\right) - 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 temp;
if ((b >= 0.0)) {
temp = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
temp = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
return temp;
}
double code(double a, double b, double c) {
double temp;
if ((b <= -1.6048696542769354e+63)) {
double temp_1;
if ((b >= 0.0)) {
temp_1 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
temp_1 = ((-b + ((2.0 * ((a * c) / b)) - b)) / (2.0 * a));
}
temp = temp_1;
} else {
double temp_2;
if ((b <= 7.587411789834341e+119)) {
double temp_3;
if ((b >= 0.0)) {
temp_3 = ((2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c)))));
} else {
temp_3 = ((sqrt((-b + sqrt(((b * b) - ((4.0 * a) * c))))) * sqrt((-b + sqrt(((b * b) - ((4.0 * a) * c)))))) / (2.0 * a));
}
temp_2 = temp_3;
} else {
double temp_4;
if ((b >= 0.0)) {
temp_4 = ((2.0 * c) / ((2.0 * (a * (c / b))) - (2.0 * b)));
} else {
temp_4 = ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
temp_2 = temp_4;
}
temp = temp_2;
}
return temp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.6048696542769354e+63Initial program 39.9
Taylor expanded around -inf 9.9
if -1.6048696542769354e+63 < b < 7.587411789834341e+119Initial program 8.8
rmApplied add-sqr-sqrt8.9
if 7.587411789834341e+119 < b Initial program 31.8
Taylor expanded around inf 6.5
rmApplied *-un-lft-identity6.5
Applied times-frac1.5
Simplified1.5
Final simplification7.6
herbie shell --seed 2020066
(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))))