\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 -1.0288136512639993 \cdot 10^{+92}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \left(\frac{\sqrt[3]{2 \cdot \left(b - \frac{c}{b} \cdot a\right)} \cdot \sqrt[3]{2 \cdot \left(b - \frac{c}{b} \cdot a\right)}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\sqrt[3]{2 \cdot \left(b - \frac{c}{b} \cdot a\right)}}{\sqrt[3]{a}}\right)\\
\mathbf{else}:\\
\;\;\;\;\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}\\
\end{array}\\
\mathbf{elif}\;b \leq -4.0127078141426725 \cdot 10^{-167}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}\\
\end{array}\\
\mathbf{elif}\;b \leq -9.704665002374583 \cdot 10^{-213}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \left(\frac{\sqrt[3]{2 \cdot \left(b - \frac{c}{b} \cdot a\right)} \cdot \sqrt[3]{2 \cdot \left(b - \frac{c}{b} \cdot a\right)}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\sqrt[3]{2 \cdot \left(b - \frac{c}{b} \cdot a\right)}}{\sqrt[3]{a}}\right)\\
\mathbf{else}:\\
\;\;\;\;\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}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.234913879083865 \cdot 10^{+67}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \left(\frac{b}{a} - \frac{c}{b}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\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}\\
\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 -1.0288136512639993e+92)
(if (>= b 0.0)
(*
-0.5
(*
(/
(*
(cbrt (* 2.0 (- b (* (/ c b) a))))
(cbrt (* 2.0 (- b (* (/ c b) a)))))
(* (cbrt a) (cbrt a)))
(/ (cbrt (* 2.0 (- b (* (/ c b) a)))) (cbrt a))))
(/
(* 2.0 c)
(- (- (* 2.0 (* (/ a (* (cbrt b) (cbrt b))) (/ c (cbrt b)))) b) b)))
(if (<= b -4.0127078141426725e-167)
(if (>= b 0.0)
(/ (- (- b) (sqrt (- (* b b) (* c (* a 4.0))))) (* 2.0 a))
(/ (* 2.0 c) (- (sqrt (- (* b b) (* c (* a 4.0)))) b)))
(if (<= b -9.704665002374583e-213)
(if (>= b 0.0)
(*
-0.5
(*
(/
(*
(cbrt (* 2.0 (- b (* (/ c b) a))))
(cbrt (* 2.0 (- b (* (/ c b) a)))))
(* (cbrt a) (cbrt a)))
(/ (cbrt (* 2.0 (- b (* (/ c b) a)))) (cbrt a))))
(/
(* 2.0 c)
(- (- (* 2.0 (* (/ a (* (cbrt b) (cbrt b))) (/ c (cbrt b)))) b) b)))
(if (<= b 1.234913879083865e+67)
(if (>= b 0.0)
(/ (- (- b) (sqrt (- (* b b) (* c (* a 4.0))))) (* 2.0 a))
(/ (* 2.0 c) (- (sqrt (- (* b b) (* c (* a 4.0)))) b)))
(if (>= b 0.0)
(* -0.5 (* 2.0 (- (/ b a) (/ c b))))
(/
(* 2.0 c)
(-
(- (* 2.0 (* (/ a (* (cbrt b) (cbrt b))) (/ c (cbrt b)))) b)
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 <= -1.0288136512639993e+92) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = -0.5 * (((cbrt(2.0 * (b - ((c / b) * a))) * cbrt(2.0 * (b - ((c / b) * a)))) / (cbrt(a) * cbrt(a))) * (cbrt(2.0 * (b - ((c / b) * a))) / cbrt(a)));
} else {
tmp_1 = (2.0 * c) / (((2.0 * ((a / (cbrt(b) * cbrt(b))) * (c / cbrt(b)))) - b) - b);
}
tmp = tmp_1;
} else if (b <= -4.0127078141426725e-167) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (-b - sqrt((b * b) - (c * (a * 4.0)))) / (2.0 * a);
} else {
tmp_2 = (2.0 * c) / (sqrt((b * b) - (c * (a * 4.0))) - b);
}
tmp = tmp_2;
} else if (b <= -9.704665002374583e-213) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = -0.5 * (((cbrt(2.0 * (b - ((c / b) * a))) * cbrt(2.0 * (b - ((c / b) * a)))) / (cbrt(a) * cbrt(a))) * (cbrt(2.0 * (b - ((c / b) * a))) / cbrt(a)));
} else {
tmp_3 = (2.0 * c) / (((2.0 * ((a / (cbrt(b) * cbrt(b))) * (c / cbrt(b)))) - b) - b);
}
tmp = tmp_3;
} else if (b <= 1.234913879083865e+67) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (-b - sqrt((b * b) - (c * (a * 4.0)))) / (2.0 * a);
} else {
tmp_4 = (2.0 * c) / (sqrt((b * b) - (c * (a * 4.0))) - b);
}
tmp = tmp_4;
} else if (b >= 0.0) {
tmp = -0.5 * (2.0 * ((b / a) - (c / b)));
} else {
tmp = (2.0 * c) / (((2.0 * ((a / (cbrt(b) * cbrt(b))) * (c / cbrt(b)))) - b) - b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.0288136512639993e92 or -4.0127078141426725e-167 < b < -9.7046650023745833e-213Initial program 27.8
Simplified27.8
Taylor expanded around -inf 11.9
rmApplied add-cube-cbrt_binary64_11311.9
Applied times-frac_binary64_848.4
Taylor expanded around inf 8.4
Simplified8.4
rmApplied add-cube-cbrt_binary64_1138.4
Applied add-cube-cbrt_binary64_1138.4
Applied times-frac_binary64_848.4
Simplified8.4
Simplified8.4
if -1.0288136512639993e92 < b < -4.0127078141426725e-167 or -9.7046650023745833e-213 < b < 1.234913879083865e67Initial program 8.9
if 1.234913879083865e67 < b Initial program 40.7
Simplified40.7
Taylor expanded around -inf 40.7
rmApplied add-cube-cbrt_binary64_11340.7
Applied times-frac_binary64_8440.7
Taylor expanded around inf 9.9
Simplified5.1
rmApplied *-un-lft-identity_binary64_785.1
Applied *-un-lft-identity_binary64_785.1
Applied times-frac_binary64_845.1
Simplified5.1
Simplified5.0
Final simplification8.1
herbie shell --seed 2020346
(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)))))))