\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 -1.1259751240381662 \cdot 10^{137}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \le 4.65690860885773435 \cdot 10^{-153}:\\
\;\;\;\;1 \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\
\mathbf{elif}\;b \le 31296389.2947799377:\\
\;\;\;\;\frac{\frac{\left({b}^{2} - {b}^{2}\right) + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3} \cdot \frac{1}{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 temp;
if ((b <= -1.1259751240381662e+137)) {
temp = ((0.5 * (c / b)) - (0.6666666666666666 * (b / a)));
} else {
double temp_1;
if ((b <= 4.6569086088577344e-153)) {
temp_1 = (1.0 * ((-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)));
} else {
double temp_2;
if ((b <= 31296389.294779938)) {
temp_2 = (((((pow(b, 2.0) - pow(b, 2.0)) + (3.0 * (a * c))) / (-b - sqrt(((b * b) - ((3.0 * a) * c))))) / 3.0) * (1.0 / a));
} else {
temp_2 = (-0.5 * (c / b));
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.1259751240381662e+137Initial program 56.5
rmApplied *-un-lft-identity56.5
Applied times-frac56.6
rmApplied div-inv56.6
Applied associate-*r*56.6
Simplified56.6
Taylor expanded around -inf 3.4
if -1.1259751240381662e+137 < b < 4.6569086088577344e-153Initial program 10.9
rmApplied *-un-lft-identity10.9
if 4.6569086088577344e-153 < b < 31296389.294779938Initial program 33.0
rmApplied *-un-lft-identity33.0
Applied times-frac33.1
rmApplied div-inv33.1
Applied associate-*r*33.1
Simplified33.1
rmApplied flip-+33.1
Simplified17.2
if 31296389.294779938 < b Initial program 55.9
rmApplied *-un-lft-identity55.9
Applied times-frac55.9
Taylor expanded around inf 6.0
Final simplification9.1
herbie shell --seed 2020065
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))