\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 -8.957255745626847 \cdot 10^{+114}:\\
\;\;\;\;\frac{1}{\frac{3}{1.5 \cdot \frac{c}{b} - 2 \cdot \frac{b}{a}}}\\
\mathbf{elif}\;b \leq -8.289375697312939 \cdot 10^{-303}:\\
\;\;\;\;\frac{1}{\frac{3}{\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a}}}\\
\mathbf{elif}\;b \leq 3970.532612665264:\\
\;\;\;\;\frac{1}{\frac{3}{\frac{a \cdot \frac{c \cdot -3}{b + \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}}{a}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\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 -8.957255745626847e+114)
(/ 1.0 (/ 3.0 (- (* 1.5 (/ c b)) (* 2.0 (/ b a)))))
(if (<= b -8.289375697312939e-303)
(/ 1.0 (/ 3.0 (/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) a)))
(if (<= b 3970.532612665264)
(/
1.0
(/
3.0
(/ (* a (/ (* c -3.0) (+ b (sqrt (- (* b b) (* 3.0 (* c a))))))) a)))
(* (/ c b) -0.5)))))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 <= -8.957255745626847e+114) {
tmp = 1.0 / (3.0 / ((1.5 * (c / b)) - (2.0 * (b / a))));
} else if (b <= -8.289375697312939e-303) {
tmp = 1.0 / (3.0 / ((sqrt((b * b) - (3.0 * (c * a))) - b) / a));
} else if (b <= 3970.532612665264) {
tmp = 1.0 / (3.0 / ((a * ((c * -3.0) / (b + sqrt((b * b) - (3.0 * (c * a)))))) / a));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -8.95725574562684703e114Initial program 50.7
Simplified50.7
rmApplied clear-num_binary64_110050.7
Simplified50.7
rmApplied flip--_binary64_107663.3
Simplified62.4
Simplified62.4
Taylor expanded around -inf 3.7
if -8.95725574562684703e114 < b < -8.28937569731293899e-303Initial program 7.8
Simplified7.8
rmApplied clear-num_binary64_11007.9
Simplified8.0
if -8.28937569731293899e-303 < b < 3970.53261266526397Initial program 25.8
Simplified25.8
rmApplied clear-num_binary64_110025.9
Simplified25.9
rmApplied flip--_binary64_107625.9
Simplified17.3
Simplified17.3
rmApplied *-un-lft-identity_binary64_110117.3
Applied times-frac_binary64_110713.8
if 3970.53261266526397 < b Initial program 55.9
Simplified55.9
Taylor expanded around inf 5.4
Final simplification7.8
herbie shell --seed 2021032
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))