\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.29357534225476664 \cdot 10^{102}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \le 1.1727389675384888 \cdot 10^{-123}:\\
\;\;\;\;\left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \frac{1}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\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 <= -2.2935753422547666e+102)) {
VAR = ((0.5 * (c / b)) - (0.6666666666666666 * (b / a)));
} else {
double VAR_1;
if ((b <= 1.1727389675384888e-123)) {
VAR_1 = ((-b + sqrt(((b * b) - ((3.0 * a) * c)))) * (1.0 / (3.0 * a)));
} else {
VAR_1 = (-0.5 * (c / b));
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.2935753422547666e+102Initial program 49.0
Taylor expanded around -inf 4.0
if -2.2935753422547666e+102 < b < 1.1727389675384888e-123Initial program 12.1
rmApplied div-inv12.1
if 1.1727389675384888e-123 < b Initial program 51.6
Taylor expanded around inf 11.0
Final simplification10.4
herbie shell --seed 2020106
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))