\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 -6.861638225360705 \cdot 10^{+123}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{3}}{a}\\
\mathbf{elif}\;b \leq 8.03613068826263 \cdot 10^{-297}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3}}{a}\\
\mathbf{elif}\;b \leq 7.877237009026803 \cdot 10^{+126}:\\
\;\;\;\;\frac{1}{3 \cdot \frac{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{c \cdot -3}}\\
\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 -6.861638225360705e+123)
(/ (/ (* b -2.0) 3.0) a)
(if (<= b 8.03613068826263e-297)
(/ (/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) 3.0) a)
(if (<= b 7.877237009026803e+126)
(/ 1.0 (* 3.0 (/ (+ b (sqrt (- (* b b) (* 3.0 (* a c))))) (* c -3.0))))
(* -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 <= -6.861638225360705e+123) {
tmp = ((b * -2.0) / 3.0) / a;
} else if (b <= 8.03613068826263e-297) {
tmp = ((sqrt((b * b) - (3.0 * (a * c))) - b) / 3.0) / a;
} else if (b <= 7.877237009026803e+126) {
tmp = 1.0 / (3.0 * ((b + sqrt((b * b) - (3.0 * (a * c)))) / (c * -3.0)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -6.8616382253607053e123Initial program 53.2
Simplified53.2
rmApplied associate-/r*_binary64_411453.2
Simplified53.2
Taylor expanded around -inf 3.6
Simplified3.6
if -6.8616382253607053e123 < b < 8.0361306882626304e-297Initial program 9.9
Simplified9.9
rmApplied associate-/r*_binary64_41149.9
Simplified9.9
if 8.0361306882626304e-297 < b < 7.8772370090268035e126Initial program 33.5
Simplified33.5
rmApplied associate-/r*_binary64_411433.6
Simplified33.5
rmApplied flip--_binary64_414533.5
Simplified16.5
Simplified16.5
rmApplied clear-num_binary64_416916.6
Simplified8.7
if 7.8772370090268035e126 < b Initial program 61.8
Simplified61.8
Taylor expanded around inf 2.1
Final simplification7.0
herbie shell --seed 2021050
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))