\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -4.11134778664368488 \cdot 10^{95}:\\
\;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\
\mathbf{elif}\;b \le 8.9463181710813709 \cdot 10^{-95}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-\sqrt[3]{b} \cdot \sqrt[3]{b}, \sqrt[3]{b}, \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\
\end{array}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 VAR;
if ((b <= -4.111347786643685e+95)) {
VAR = (((1.5 * ((a * c) / b)) - (2.0 * b)) / (3.0 * a));
} else {
double VAR_1;
if ((b <= 8.946318171081371e-95)) {
VAR_1 = (fma(-(cbrt(b) * cbrt(b)), cbrt(b), sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a));
} else {
VAR_1 = ((-1.5 * ((a * c) / b)) / (3.0 * a));
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -4.111347786643685e+95Initial program 45.4
Taylor expanded around -inf 9.9
if -4.111347786643685e+95 < b < 8.946318171081371e-95Initial program 12.7
rmApplied add-cube-cbrt12.8
Applied distribute-lft-neg-in12.8
Applied fma-def12.8
if 8.946318171081371e-95 < b Initial program 52.6
Taylor expanded around inf 21.5
Final simplification16.0
herbie shell --seed 2020102 +o rules:numerics
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))