\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\begin{array}{l}
\mathbf{if}\;b \leq -2.1862818475653883 \cdot 10^{+110}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.8316947248186715 \cdot 10^{-33}:\\
\;\;\;\;\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}(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
:precision binary64
(if (<= b -2.1862818475653883e+110)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 2.8316947248186715e-33)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(* -0.5 (/ c b)))))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 tmp;
if (b <= -2.1862818475653883e+110) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.8316947248186715e-33) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.18628184756538831e110Initial program 50.3
Simplified50.3
Taylor expanded around -inf 3.4
Simplified3.4
if -2.18628184756538831e110 < b < 2.8316947248186715e-33Initial program 14.4
Simplified14.4
if 2.8316947248186715e-33 < b Initial program 54.6
Simplified54.6
Taylor expanded around inf 6.8
Final simplification10.0
herbie shell --seed 2021173
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))