\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 -425882.49394125835:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \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 6.4417367273105074 \cdot 10^{+103}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \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}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \left(\frac{c \cdot a}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(2 \cdot \frac{c \cdot a}{b} - 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 -425882.49394125835)
(if (>= b 0.0)
(/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* c (* 4.0 a))))))
(- (/ c b) (/ b a)))
(if (<= b 6.4417367273105074e+103)
(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) (* 2.0 a)))
(if (>= b 0.0)
(/ (* 2.0 c) (* 2.0 (- (/ (* c a) 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 = (2.0 * c) / (-b - sqrt((b * b) - ((4.0 * a) * c)));
} else {
tmp = (-b + sqrt((b * b) - ((4.0 * a) * c))) / (2.0 * a);
}
return tmp;
}
double code(double a, double b, double c) {
double tmp;
if (b <= -425882.49394125835) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (2.0 * c) / (-b - sqrt((b * b) - (c * (4.0 * a))));
} else {
tmp_1 = (c / b) - (b / a);
}
tmp = tmp_1;
} else if (b <= 6.4417367273105074e+103) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (2.0 * c) / (-b - (sqrt(sqrt((b * b) - (c * (4.0 * a)))) * sqrt(sqrt((b * b) - (c * (4.0 * a))))));
} else {
tmp_2 = (sqrt((b * b) - (c * (4.0 * a))) - b) / (2.0 * a);
}
tmp = tmp_2;
} else if (b >= 0.0) {
tmp = (2.0 * c) / (2.0 * (((c * a) / b) - b));
} else {
tmp = (((2.0 * ((c * a) / b)) - b) - b) / (2.0 * a);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -425882.493941258348Initial program 32.2
Taylor expanded around -inf 11.5
Taylor expanded around 0 7.4
if -425882.493941258348 < b < 6.441736727310507e103Initial program 9.8
rmApplied add-sqr-sqrt_binary6410.0
if 6.441736727310507e103 < b Initial program 30.5
Taylor expanded around -inf 30.5
Taylor expanded around inf 6.7
Simplified6.7
Final simplification8.6
herbie shell --seed 2020277
(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))))