\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 -2.427668844436332 \cdot 10^{79}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1.5 \cdot \frac{a}{b}, c, -2 \cdot b\right)}{3 \cdot a}\\
\mathbf{elif}\;b \le 3.62273985298184147 \cdot 10^{-79}:\\
\;\;\;\;\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 temp;
if ((b <= -2.4276688444363324e+79)) {
temp = (fma((1.5 * (a / b)), c, (-2.0 * b)) / (3.0 * a));
} else {
double temp_1;
if ((b <= 3.6227398529818415e-79)) {
temp_1 = (fma((cbrt(b) * cbrt(b)), -cbrt(b), sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a));
} else {
temp_1 = (-(1.5 * ((a * c) / b)) / (3.0 * a));
}
temp = temp_1;
}
return temp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.4276688444363324e+79Initial program 43.9
rmApplied add-cube-cbrt44.1
Applied distribute-rgt-neg-in44.1
Applied fma-def44.1
Taylor expanded around -inf 11.5
Simplified5.0
if -2.4276688444363324e+79 < b < 3.6227398529818415e-79Initial program 12.2
rmApplied add-cube-cbrt12.4
Applied distribute-rgt-neg-in12.4
Applied fma-def12.4
if 3.6227398529818415e-79 < b Initial program 53.1
rmApplied add-cube-cbrt56.4
Applied distribute-rgt-neg-in56.4
Applied fma-def57.0
Taylor expanded around inf 19.4
Final simplification14.0
herbie shell --seed 2020057 +o rules:numerics
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))