\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 -1.1277279800686637 \cdot 10^{+154}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(2 \cdot \left(\frac{a}{\sqrt[3]{b} \cdot \sqrt[3]{b}} \cdot \frac{c}{\sqrt[3]{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 7.829617407859173 \cdot 10^{+37}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}} \cdot \sqrt{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(2 \cdot \left(\left(\sqrt[3]{\frac{a}{\sqrt[3]{b} \cdot \sqrt[3]{b}}} \cdot \sqrt[3]{\frac{a}{\sqrt[3]{b} \cdot \sqrt[3]{b}}}\right) \cdot \left(\frac{c}{\sqrt[3]{b}} \cdot \sqrt[3]{\frac{a}{\sqrt[3]{b} \cdot \sqrt[3]{b}}}\right)\right) - b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\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 -1.1277279800686637e+154)
(if (>= b 0.0)
(/
(* 2.0 c)
(- (- (* 2.0 (* (/ a (* (cbrt b) (cbrt b))) (/ c (cbrt b)))) b) b))
(/ (- (- (* 2.0 (* c (/ a b))) b) b) (* 2.0 a)))
(if (<= b 7.829617407859173e+37)
(if (>= b 0.0)
(/
(* 2.0 c)
(-
(- b)
(*
(sqrt (sqrt (- (* b b) (* c (* a 4.0)))))
(sqrt (sqrt (- (* b b) (* c (* a 4.0))))))))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a)))
(if (>= b 0.0)
(/
(* 2.0 c)
(-
(-
(*
2.0
(*
(*
(cbrt (/ a (* (cbrt b) (cbrt b))))
(cbrt (/ a (* (cbrt b) (cbrt b)))))
(* (/ c (cbrt b)) (cbrt (/ a (* (cbrt b) (cbrt b)))))))
b)
b))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) 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 <= -1.1277279800686637e+154) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (2.0 * c) / (((2.0 * ((a / (cbrt(b) * cbrt(b))) * (c / cbrt(b)))) - b) - b);
} else {
tmp_1 = (((2.0 * (c * (a / b))) - b) - b) / (2.0 * a);
}
tmp = tmp_1;
} else if (b <= 7.829617407859173e+37) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (2.0 * c) / (-b - (sqrt(sqrt((b * b) - (c * (a * 4.0)))) * sqrt(sqrt((b * b) - (c * (a * 4.0))))));
} else {
tmp_2 = (sqrt((b * b) - (c * (a * 4.0))) - b) / (2.0 * a);
}
tmp = tmp_2;
} else if (b >= 0.0) {
tmp = (2.0 * c) / (((2.0 * ((cbrt(a / (cbrt(b) * cbrt(b))) * cbrt(a / (cbrt(b) * cbrt(b)))) * ((c / cbrt(b)) * cbrt(a / (cbrt(b) * cbrt(b)))))) - b) - b);
} else {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (2.0 * a);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.1277279800686637e154Initial program 64.0
Taylor expanded around inf 64.0
rmApplied add-cube-cbrt_binary6464.0
Applied times-frac_binary6464.0
Taylor expanded around -inf 10.8
Simplified1.8
if -1.1277279800686637e154 < b < 7.82961740785917273e37Initial program 8.8
rmApplied add-sqr-sqrt_binary648.9
if 7.82961740785917273e37 < b Initial program 25.2
Taylor expanded around inf 6.8
rmApplied add-cube-cbrt_binary646.8
Applied times-frac_binary643.7
rmApplied add-cube-cbrt_binary643.7
Applied associate-*l*_binary643.7
Simplified3.7
Final simplification6.6
herbie shell --seed 2020232
(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))))