\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.991777674964526 \cdot 10^{+115}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq -2.3801565570057447 \cdot 10^{-178}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 5.197649067580201 \cdot 10^{+52}:\\
\;\;\;\;c \cdot \frac{-1}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\
\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.991777674964526e+115)
(/ (* b -2.0) (* 3.0 a))
(if (<= b -2.3801565570057447e-178)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* 3.0 a))
(if (<= b 5.197649067580201e+52)
(* c (/ -1.0 (+ b (sqrt (- (* b b) (* (* 3.0 a) c))))))
(* -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.991777674964526e+115) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= -2.3801565570057447e-178) {
tmp = (sqrt((b * b) - (3.0 * (a * c))) - b) / (3.0 * a);
} else if (b <= 5.197649067580201e+52) {
tmp = c * (-1.0 / (b + sqrt((b * b) - ((3.0 * a) * c))));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.99177767496452593e115Initial program 50.4
Simplified50.4
Taylor expanded around -inf 4.1
Simplified4.1
if -2.99177767496452593e115 < b < -2.3801565570057447e-178Initial program 6.5
Simplified6.5
rmApplied associate-*l*_binary64_51346.5
if -2.3801565570057447e-178 < b < 5.19764906758020092e52Initial program 25.9
Simplified25.9
rmApplied flip--_binary64_516826.2
Simplified16.3
Simplified16.3
rmApplied clear-num_binary64_519216.4
Simplified10.7
rmApplied associate-*r/_binary64_513510.6
Applied associate-/r/_binary64_513910.5
Simplified10.5
if 5.19764906758020092e52 < b Initial program 57.9
Simplified57.9
rmApplied flip--_binary64_516857.9
Simplified29.0
Simplified29.0
Taylor expanded around 0 3.7
Final simplification6.7
herbie shell --seed 2020357
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))