\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.252365262196174 \cdot 10^{+104}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + \left(b - 2 \cdot \left(\frac{a}{\sqrt[3]{b} \cdot \sqrt[3]{b}} \cdot \frac{c}{\sqrt[3]{b}}\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \left(c \cdot \frac{a}{b} - b\right)}\\
\end{array}\\
\mathbf{elif}\;b \leq -2.276046310772245 \cdot 10^{-283}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \left(\frac{\sqrt{2 \cdot \left(b - \frac{a \cdot c}{b}\right)}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\sqrt{2 \cdot \left(b - \frac{a \cdot c}{b}\right)}}{\sqrt[3]{a}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}\\
\end{array}\\
\mathbf{elif}\;b \leq 4.084166787237329 \cdot 10^{+98}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\sqrt{\frac{{b}^{4} - a \cdot \left(c \cdot \left(\left(a \cdot c\right) \cdot 16\right)\right)}{b \cdot b + c \cdot \left(a \cdot 4\right)}} - b}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + \left(b - 2 \cdot \left(\frac{\frac{a}{\sqrt[3]{b} \cdot \sqrt[3]{b}}}{\sqrt[3]{\sqrt[3]{b} \cdot \sqrt[3]{b}}} \cdot \frac{c}{\sqrt[3]{\sqrt[3]{b}}}\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - 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.252365262196174e+104)
(if (>= b 0.0)
(*
-0.5
(/ (+ b (- b (* 2.0 (* (/ a (* (cbrt b) (cbrt b))) (/ c (cbrt b)))))) a))
(/ (* 2.0 c) (* 2.0 (- (* c (/ a b)) b))))
(if (<= b -2.276046310772245e-283)
(if (>= b 0.0)
(*
-0.5
(*
(/ (sqrt (* 2.0 (- b (/ (* a c) b)))) (* (cbrt a) (cbrt a)))
(/ (sqrt (* 2.0 (- b (/ (* a c) b)))) (cbrt a))))
(/ (* 2.0 c) (- (sqrt (- (* b b) (* c (* a 4.0)))) b)))
(if (<= b 4.084166787237329e+98)
(if (>= b 0.0)
(* -0.5 (/ (+ b (sqrt (- (* b b) (* c (* a 4.0))))) a))
(/
(* 2.0 c)
(-
(sqrt
(/
(- (pow b 4.0) (* a (* c (* (* a c) 16.0))))
(+ (* b b) (* c (* a 4.0)))))
b)))
(if (>= b 0.0)
(*
-0.5
(/
(+
b
(-
b
(*
2.0
(*
(/ (/ a (* (cbrt b) (cbrt b))) (cbrt (* (cbrt b) (cbrt b))))
(/ c (cbrt (cbrt b)))))))
a))
(/ (* 2.0 c) (- (sqrt (- (* b b) (* c (* a 4.0)))) 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.252365262196174e+104) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = -0.5 * ((b + (b - (2.0 * ((a / (cbrt(b) * cbrt(b))) * (c / cbrt(b)))))) / a);
} else {
tmp_1 = (2.0 * c) / (2.0 * ((c * (a / b)) - b));
}
tmp = tmp_1;
} else if (b <= -2.276046310772245e-283) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -0.5 * ((sqrt(2.0 * (b - ((a * c) / b))) / (cbrt(a) * cbrt(a))) * (sqrt(2.0 * (b - ((a * c) / b))) / cbrt(a)));
} else {
tmp_2 = (2.0 * c) / (sqrt((b * b) - (c * (a * 4.0))) - b);
}
tmp = tmp_2;
} else if (b <= 4.084166787237329e+98) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = -0.5 * ((b + sqrt((b * b) - (c * (a * 4.0)))) / a);
} else {
tmp_3 = (2.0 * c) / (sqrt((pow(b, 4.0) - (a * (c * ((a * c) * 16.0)))) / ((b * b) + (c * (a * 4.0)))) - b);
}
tmp = tmp_3;
} else if (b >= 0.0) {
tmp = -0.5 * ((b + (b - (2.0 * (((a / (cbrt(b) * cbrt(b))) / cbrt(cbrt(b) * cbrt(b))) * (c / cbrt(cbrt(b))))))) / a);
} else {
tmp = (2.0 * c) / (sqrt((b * b) - (c * (a * 4.0))) - b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -6.25236526219617385e104Initial program 31.0
Simplified31.0
Taylor expanded around inf 31.0
rmApplied add-cube-cbrt_binary64_10931.0
Applied times-frac_binary64_8331.0
Taylor expanded around -inf 6.2
Simplified2.4
if -6.25236526219617385e104 < b < -2.27604631077224517e-283Initial program 8.2
Simplified8.2
Taylor expanded around inf 8.2
rmApplied add-cube-cbrt_binary64_1098.2
Applied add-sqr-sqrt_binary64_988.2
Applied times-frac_binary64_838.2
Simplified8.2
Simplified8.2
if -2.27604631077224517e-283 < b < 4.0841667872373289e98Initial program 9.9
Simplified9.9
rmApplied flip--_binary64_5210.9
Simplified11.1
if 4.0841667872373289e98 < b Initial program 46.9
Simplified46.9
Taylor expanded around inf 10.9
rmApplied add-cube-cbrt_binary64_10910.9
Applied times-frac_binary64_834.5
rmApplied add-cube-cbrt_binary64_1094.5
Applied cbrt-prod_binary64_1054.5
Applied *-un-lft-identity_binary64_774.5
Applied times-frac_binary64_834.5
Applied associate-*r*_binary64_194.5
Simplified4.5
Final simplification7.2
herbie shell --seed 2020281
(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)))))))