\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\end{array}\begin{array}{l}
\mathbf{if}\;b \leq -6.130306482326166 \cdot 10^{+159}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{\sqrt{0} - b}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.3570002931602082 \cdot 10^{+154}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{\left|\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}\right| \cdot \sqrt{\sqrt[3]{{\left(\sqrt{\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{4}} \cdot \sqrt[3]{\sqrt[3]{b \cdot b - \left(4 \cdot a\right) \cdot c}}} - b}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{0}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}\\
\end{array}(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))
(FPCore (a b c)
:precision binary64
(if (<= b -6.130306482326166e+159)
(if (>= b 0.0)
(* -0.5 (/ (+ b (sqrt (- (* b b) (* (* 4.0 a) c)))) a))
(/ (* c 2.0) (- (sqrt 0.0) b)))
(if (<= b 1.3570002931602082e+154)
(if (>= b 0.0)
(* -0.5 (/ (+ b (sqrt (- (* b b) (* (* 4.0 a) c)))) a))
(/
(* c 2.0)
(-
(*
(fabs (cbrt (- (* b b) (* (* 4.0 a) c))))
(sqrt
(*
(cbrt (pow (sqrt (cbrt (- (* b b) (* (* 4.0 a) c)))) 4.0))
(cbrt (cbrt (- (* b b) (* (* 4.0 a) c)))))))
b)))
(if (>= b 0.0)
(* -0.5 (/ (+ b (sqrt 0.0)) a))
(/ (* c 2.0) (- (sqrt (- (* b b) (* (* 4.0 a) c))) b))))))double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (-b - sqrt((b * b) - ((4.0 * a) * c))) / (2.0 * a);
} else {
tmp = (2.0 * c) / (-b + sqrt((b * b) - ((4.0 * a) * c)));
}
return tmp;
}
double code(double a, double b, double c) {
double tmp;
if (b <= -6.130306482326166e+159) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = -0.5 * ((b + sqrt((b * b) - ((4.0 * a) * c))) / a);
} else {
tmp_1 = (c * 2.0) / (sqrt(0.0) - b);
}
tmp = tmp_1;
} else if (b <= 1.3570002931602082e+154) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -0.5 * ((b + sqrt((b * b) - ((4.0 * a) * c))) / a);
} else {
tmp_2 = (c * 2.0) / ((fabs(cbrt((b * b) - ((4.0 * a) * c))) * sqrt(cbrt(pow(sqrt(cbrt((b * b) - ((4.0 * a) * c))), 4.0)) * cbrt(cbrt((b * b) - ((4.0 * a) * c))))) - b);
}
tmp = tmp_2;
} else if (b >= 0.0) {
tmp = -0.5 * ((b + sqrt(0.0)) / a);
} else {
tmp = (c * 2.0) / (sqrt((b * b) - ((4.0 * a) * c)) - b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -6.13030648232616621e159Initial program 38.2
Simplified38.2
Taylor expanded around inf 32.7
if -6.13030648232616621e159 < b < 1.35700029316020823e154Initial program 8.5
Simplified8.5
rmApplied add-cube-cbrt_binary648.7
Applied sqrt-prod_binary648.7
Simplified8.7
rmApplied add-cube-cbrt_binary648.7
Applied cbrt-prod_binary648.7
Simplified8.7
if 1.35700029316020823e154 < b Initial program 64.0
Simplified64.0
Taylor expanded around inf 52.2
Final simplification17.6
herbie shell --seed 2020268
(FPCore (a b c)
:name "jeff quadratic root 1"
:precision binary64
(if (>= b 0.0) (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))