\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 -1.175532362255663 \cdot 10^{+108}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 5.378674763733228 \cdot 10^{-110}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} - \frac{b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 8215236509114848:\\
\;\;\;\;\frac{a \cdot \left(c \cdot -3\right)}{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}} \cdot \frac{0.3333333333333333}{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 -1.175532362255663e+108)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 5.378674763733228e-110)
(- (/ (sqrt (- (* b b) (* (* 3.0 a) c))) (* 3.0 a)) (/ b (* 3.0 a)))
(if (<= b 8215236509114848.0)
(*
(/ (* a (* c -3.0)) (+ b (sqrt (- (* b b) (* 3.0 (* a c))))))
(/ 0.3333333333333333 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 <= -1.175532362255663e+108) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 5.378674763733228e-110) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) / (3.0 * a)) - (b / (3.0 * a));
} else if (b <= 8215236509114848.0) {
tmp = ((a * (c * -3.0)) / (b + sqrt((b * b) - (3.0 * (a * c))))) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.17553236225566309e108Initial program 47.7
Simplified47.7
Taylor expanded around -inf 4.2
if -1.17553236225566309e108 < b < 5.37867476373322791e-110Initial program 11.9
Simplified11.9
rmApplied div-sub_binary6411.9
if 5.37867476373322791e-110 < b < 8215236509114848Initial program 36.3
Simplified36.3
rmApplied div-inv_binary6436.3
Simplified36.4
rmApplied flip--_binary6436.4
Simplified15.8
Simplified15.8
if 8215236509114848 < b Initial program 56.6
Simplified56.6
Taylor expanded around inf 5.3
Final simplification9.1
herbie shell --seed 2021118
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))