\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 -5.937328566151444 \cdot 10^{+119}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + \frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{elif}\;b \leq 1.9911819164430855 \cdot 10^{-143}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 8.101478123646484 \cdot 10^{+82}:\\
\;\;\;\;\frac{a \cdot \left(c \cdot -3\right)}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}} \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{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 -5.937328566151444e+119)
(+ (* 0.5 (/ c b)) (* (/ b a) -0.6666666666666666))
(if (<= b 1.9911819164430855e-143)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 8.101478123646484e+82)
(*
(/ (* a (* c -3.0)) (+ b (sqrt (- (* b b) (* c (* a 3.0))))))
(/ 0.3333333333333333 a))
(/ (* c -0.5) 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 <= -5.937328566151444e+119) {
tmp = (0.5 * (c / b)) + ((b / a) * -0.6666666666666666);
} else if (b <= 1.9911819164430855e-143) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (a * 3.0);
} else if (b <= 8.101478123646484e+82) {
tmp = ((a * (c * -3.0)) / (b + sqrt((b * b) - (c * (a * 3.0))))) * (0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -5.9373285661514437e119Initial program 52.5
Simplified52.5
Taylor expanded around -inf 2.6
Simplified2.6
if -5.9373285661514437e119 < b < 1.9911819164430855e-143Initial program 11.1
Simplified11.1
if 1.9911819164430855e-143 < b < 8.1014781236464845e82Initial program 39.4
Simplified39.4
rmApplied div-inv_binary64_246239.4
Simplified39.5
rmApplied flip--_binary64_244039.5
Simplified16.6
Simplified16.6
if 8.1014781236464845e82 < b Initial program 58.6
Simplified58.6
Taylor expanded around inf 3.0
rmApplied associate-*r/_binary64_24073.0
Final simplification9.0
herbie shell --seed 2020353
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))