\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\begin{array}{l}
\mathbf{if}\;b \leq -1.722835689509259 \cdot 10^{+119}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.8863642337546708 \cdot 10^{-35}:\\
\;\;\;\;\left(\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
:precision binary64
(if (<= b -1.722835689509259e+119)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b 1.8863642337546708e-35)
(* (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (/ 0.3333333333333333 a))
(* (/ c b) -0.5))))double code(double a, double b, double c) {
return (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))) / ((double) (3.0 * a)));
}
double code(double a, double b, double c) {
double tmp;
if ((b <= -1.722835689509259e+119)) {
tmp = ((double) (((double) (0.5 * (c / b))) - ((double) (0.6666666666666666 * (b / a)))));
} else {
double tmp_1;
if ((b <= 1.8863642337546708e-35)) {
tmp_1 = ((double) (((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 3.0)))))))) - b)) * (0.3333333333333333 / a)));
} else {
tmp_1 = ((double) ((c / b) * -0.5));
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.72283568950925888e119Initial program 52.9
Simplified52.9
Taylor expanded around -inf 3.9
if -1.72283568950925888e119 < b < 1.8863642337546708e-35Initial program 14.1
Simplified14.1
rmApplied div-inv_binary6414.2
Simplified14.2
if 1.8863642337546708e-35 < b Initial program 54.9
Simplified54.9
Taylor expanded around inf 7.7
Final simplification10.4
herbie shell --seed 2020210
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))