\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 -3.6419385251769567 \cdot 10^{+130}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.827145917976237 \cdot 10^{+108}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;-2 \cdot \frac{c}{2 \cdot \left(b - \frac{c \cdot a}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\
\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 -3.6419385251769567e+130)
(if (>= b 0.0)
(* -2.0 (/ c (+ b (sqrt (- (* b b) (* c (* 4.0 a)))))))
(- (/ c b) (/ b a)))
(if (<= b 1.827145917976237e+108)
(if (>= b 0.0)
(*
-2.0
(/
c
(+
b
(*
(sqrt (sqrt (- (* b b) (* c (* 4.0 a)))))
(sqrt (sqrt (- (* b b) (* c (* 4.0 a)))))))))
(/ (- (sqrt (- (* b b) (* c (* 4.0 a)))) b) (* a 2.0)))
(if (>= b 0.0)
(* -2.0 (/ c (* 2.0 (- b (/ (* c a) b)))))
(/ (- (sqrt (- (* b b) (* c (* 4.0 a)))) b) (* a 2.0))))))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 <= -3.6419385251769567e+130)) {
double tmp_1;
if ((b >= 0.0)) {
tmp_1 = ((double) (-2.0 * (c / ((double) (b + ((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (4.0 * a)))))))))))));
} else {
tmp_1 = ((double) ((c / b) - (b / a)));
}
tmp = tmp_1;
} else {
double tmp_2;
if ((b <= 1.827145917976237e+108)) {
double tmp_3;
if ((b >= 0.0)) {
tmp_3 = ((double) (-2.0 * (c / ((double) (b + ((double) (((double) sqrt(((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (4.0 * a)))))))))) * ((double) sqrt(((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (4.0 * a)))))))))))))))));
} else {
tmp_3 = (((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (4.0 * a)))))))) - b)) / ((double) (a * 2.0)));
}
tmp_2 = tmp_3;
} else {
double tmp_4;
if ((b >= 0.0)) {
tmp_4 = ((double) (-2.0 * (c / ((double) (2.0 * ((double) (b - (((double) (c * a)) / b))))))));
} else {
tmp_4 = (((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (4.0 * a)))))))) - b)) / ((double) (a * 2.0)));
}
tmp_2 = tmp_4;
}
tmp = tmp_2;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.64193852517695668e130Initial program 54.8
Simplified54.8
Taylor expanded around -inf 10.3
Simplified10.3
Taylor expanded around 0 3.8
if -3.64193852517695668e130 < b < 1.82714591797623707e108Initial program 8.5
Simplified8.5
rmApplied add-sqr-sqrt_binary648.5
Applied sqrt-prod_binary648.6
if 1.82714591797623707e108 < b Initial program 29.2
Simplified29.2
Taylor expanded around inf 6.2
Simplified6.2
Final simplification7.5
herbie shell --seed 2020210
(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))))