\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 -5.2389466313579672 \cdot 10^{127}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \le 1.6670468245058271 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{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 temp;
if ((b <= -5.238946631357967e+127)) {
temp = ((0.5 * (c / b)) - (0.6666666666666666 * (b / a)));
} else {
double temp_1;
if ((b <= 1.667046824505827e-85)) {
temp_1 = ((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a));
} else {
temp_1 = (-0.5 * (c / b));
}
temp = temp_1;
}
return temp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -5.238946631357967e+127Initial program 54.3
Taylor expanded around -inf 3.6
if -5.238946631357967e+127 < b < 1.667046824505827e-85Initial program 12.3
rmApplied *-un-lft-identity12.3
Applied times-frac12.4
rmApplied frac-times12.3
Simplified12.3
if 1.667046824505827e-85 < b Initial program 52.8
Taylor expanded around inf 9.7
Final simplification10.1
herbie shell --seed 2020056 +o rules:numerics
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))