\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 -4.1275090717025735 \cdot 10^{+127}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(2 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(2 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \leq -2.780192689850507 \cdot 10^{-300}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{-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 2.838341990170196 \cdot 10^{+126}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left(\left(2 \cdot \frac{c \cdot a}{b} - b\right) - b\right)}}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(2 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(2 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}{2 \cdot a}\\
\end{array}(FPCore (a b c) :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))))
(FPCore (a b c)
:precision binary64
(if (<= b -4.1275090717025735e+127)
(if (>= b 0.0)
(/ (* 2.0 c) (- (- (* 2.0 (* c (/ a b))) b) b))
(/ (- (- (* 2.0 (* c (/ a b))) b) b) (* 2.0 a)))
(if (<= b -2.780192689850507e-300)
(if (>= b 0.0)
(/ (* 2.0 c) (- b))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a)))
(if (<= b 2.838341990170196e+126)
(if (>= b 0.0)
(/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* c (* a 4.0))))))
(/ (exp (log (- (- (* 2.0 (/ (* c a) b)) b) b))) (* 2.0 a)))
(if (>= b 0.0)
(/ (* 2.0 c) (- (- (* 2.0 (* c (/ a b))) b) b))
(/ (- (- (* 2.0 (* c (/ a b))) b) b) (* 2.0 a)))))))double code(double a, double b, double c) {
double tmp;
if ((b >= 0.0)) {
tmp = (((double) (2.0 * c)) / ((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (4.0 * a)) * c)))))))));
} else {
tmp = (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (4.0 * a)) * c)))))))) / ((double) (2.0 * a)));
}
return tmp;
}
double code(double a, double b, double c) {
double tmp;
if ((b <= -4.1275090717025735e+127)) {
double tmp_1;
if ((b >= 0.0)) {
tmp_1 = (((double) (2.0 * c)) / ((double) (((double) (((double) (2.0 * ((double) (c * (a / b))))) - b)) - b)));
} else {
tmp_1 = (((double) (((double) (((double) (2.0 * ((double) (c * (a / b))))) - b)) - b)) / ((double) (2.0 * a)));
}
tmp = tmp_1;
} else {
double tmp_2;
if ((b <= -2.780192689850507e-300)) {
double tmp_3;
if ((b >= 0.0)) {
tmp_3 = (((double) (2.0 * c)) / ((double) -(b)));
} else {
tmp_3 = (((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 4.0)))))))) - b)) / ((double) (2.0 * a)));
}
tmp_2 = tmp_3;
} else {
double tmp_4;
if ((b <= 2.838341990170196e+126)) {
double tmp_5;
if ((b >= 0.0)) {
tmp_5 = (((double) (2.0 * c)) / ((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 4.0)))))))))));
} else {
tmp_5 = (((double) exp(((double) log(((double) (((double) (((double) (2.0 * (((double) (c * a)) / b))) - b)) - b)))))) / ((double) (2.0 * a)));
}
tmp_4 = tmp_5;
} else {
double tmp_6;
if ((b >= 0.0)) {
tmp_6 = (((double) (2.0 * c)) / ((double) (((double) (((double) (2.0 * ((double) (c * (a / b))))) - b)) - b)));
} else {
tmp_6 = (((double) (((double) (((double) (2.0 * ((double) (c * (a / b))))) - b)) - b)) / ((double) (2.0 * a)));
}
tmp_4 = tmp_6;
}
tmp_2 = tmp_4;
}
tmp = tmp_2;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -4.12750907170257349e127 or 2.83834199017019573e126 < b Initial program 42.0
Simplified42.0
Taylor expanded around inf 25.0
Simplified25.0
rmApplied *-un-lft-identity_binary6425.0
Applied times-frac_binary6422.4
Simplified22.4
Taylor expanded around -inf 5.2
Simplified2.5
if -4.12750907170257349e127 < b < -2.78019268985050695e-300Initial program 8.8
Simplified8.8
Taylor expanded around 0 8.8
if -2.78019268985050695e-300 < b < 2.83834199017019573e126Initial program 8.7
Simplified8.7
rmApplied add-exp-log_binary648.8
Taylor expanded around -inf 9.2
Simplified9.2
Final simplification6.9
herbie shell --seed 2020204
(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))))