\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.569045129100026 \cdot 10^{+109}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -1.8264876192729505 \cdot 10^{-225}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 7.787065085468061 \cdot 10^{+124}:\\
\;\;\;\;\frac{1}{\frac{-\left(b + \sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)}\right)}{c}}\\
\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.569045129100026e+109)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b -1.8264876192729505e-225)
(/ (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (* a 3.0))
(if (<= b 7.787065085468061e+124)
(/ 1.0 (/ (- (+ b (sqrt (+ (* b b) (* a (* c -3.0)))))) c))
(* (/ c b) -0.5)))))double code(double a, double b, double c) {
return (-b + sqrt((b * b) - ((3.0 * a) * c))) / (3.0 * a);
}
double code(double a, double b, double c) {
double tmp;
if (b <= -1.569045129100026e+109) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= -1.8264876192729505e-225) {
tmp = (sqrt((b * b) + (a * (c * -3.0))) - b) / (a * 3.0);
} else if (b <= 7.787065085468061e+124) {
tmp = 1.0 / (-(b + sqrt((b * b) + (a * (c * -3.0)))) / c);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.56904512910002603e109Initial program 49.1
Simplified49.1
Taylor expanded around -inf 3.9
if -1.56904512910002603e109 < b < -1.82648761927295047e-225Initial program 7.6
Simplified7.6
rmApplied sub-neg_binary64_17767.6
Simplified7.7
if -1.82648761927295047e-225 < b < 7.7870650854680606e124Initial program 31.2
Simplified31.2
rmApplied flip--_binary64_175831.3
Simplified16.6
Simplified16.6
rmApplied clear-num_binary64_178216.8
Simplified9.9
rmApplied sub-neg_binary64_17769.9
Simplified9.9
rmApplied associate-*r/_binary64_17259.9
Simplified9.9
if 7.7870650854680606e124 < b Initial program 61.0
Simplified61.0
Taylor expanded around inf 1.4
Final simplification6.7
herbie shell --seed 2020298
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))