\begin{array}{l}
\mathbf{if}\;b \geq 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 \leq -6.57239956873832 \cdot 10^{+148}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;2 \cdot \frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \leq 3.2284907585376 \cdot 10^{-310}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;2 \cdot \frac{c}{\left(2 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.4342762859357804 \cdot 10^{+50}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;2 \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{c \cdot a}{b} + b \cdot -2}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;2 \cdot \frac{c}{b \cdot -2 + c \cdot \frac{2 \cdot a}{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 = (((double) (2.0 * c)) / ((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (4.0 * a)) * c)))))))));
} else {
VAR = (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (4.0 * a)) * c)))))))) / ((double) (2.0 * a)));
}
return VAR;
}
double code(double a, double b, double c) {
double VAR;
if ((b <= -6.57239956873832e+148)) {
double VAR_1;
if ((b >= 0.0)) {
VAR_1 = ((double) (2.0 * (((double) -(c)) / b)));
} else {
VAR_1 = ((double) (1.0 * ((double) ((c / b) - (b / a)))));
}
VAR = VAR_1;
} else {
double VAR_2;
if ((b <= 3.2284907585376e-310)) {
double VAR_3;
if ((b >= 0.0)) {
VAR_3 = ((double) (2.0 * (c / ((double) (((double) (((double) (2.0 * ((double) (c * (a / b))))) - b)) - b)))));
} else {
VAR_3 = (((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 4.0)))))))) - b)) / ((double) (2.0 * a)));
}
VAR_2 = VAR_3;
} else {
double VAR_4;
if ((b <= 1.4342762859357804e+50)) {
double VAR_5;
if ((b >= 0.0)) {
VAR_5 = ((double) (2.0 * (c / ((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 4.0)))))))))))));
} else {
VAR_5 = (((double) (((double) (2.0 * (((double) (c * a)) / b))) + ((double) (b * -2.0)))) / ((double) (2.0 * a)));
}
VAR_4 = VAR_5;
} else {
double VAR_6;
if ((b >= 0.0)) {
VAR_6 = ((double) (2.0 * (c / ((double) (((double) (b * -2.0)) + ((double) (c * (((double) (2.0 * a)) / b))))))));
} else {
VAR_6 = ((double) (1.0 * ((double) ((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 < -6.5723995687383196e148Initial program 61.0
Simplified61.0
Taylor expanded around -inf 10.1
Simplified2.5
Taylor expanded around 0 2.3
Simplified2.3
Taylor expanded around inf 2.3
Simplified2.3
if -6.5723995687383196e148 < b < 3.22849075853761e-310Initial program 8.4
Simplified8.4
Taylor expanded around inf 8.4
Simplified8.4
if 3.22849075853761e-310 < b < 1.4342762859357804e50Initial program 9.2
Simplified9.2
Taylor expanded around -inf 9.2
Simplified9.2
rmApplied associate-*r/9.2
if 1.4342762859357804e50 < b Initial program 26.3
Simplified26.3
Taylor expanded around -inf 26.3
Simplified26.3
Taylor expanded around 0 26.3
Simplified26.3
Taylor expanded around inf 7.7
Simplified4.1
Final simplification6.7
herbie shell --seed 2020199
(FPCore (a b c)
:name "jeff quadratic root 2"
:precision binary64
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))