\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.0903228605467135 \cdot 10^{+124}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{3}}{a}\\
\mathbf{elif}\;b \leq 6.898705638118464 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot 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 -2.0903228605467135e+124)
(/ (/ (* b -2.0) 3.0) a)
(if (<= b 6.898705638118464e-47)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 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 <= -2.0903228605467135e+124) {
tmp = ((b * -2.0) / 3.0) / a;
} else if (b <= 6.898705638118464e-47) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.0903228605467135e124Initial program 52.6
Simplified52.6
rmApplied associate-/r*_binary64_479652.6
Simplified52.6
Taylor expanded around -inf 3.9
if -2.0903228605467135e124 < b < 6.89870563811846439e-47Initial program 14.1
Simplified14.1
if 6.89870563811846439e-47 < b Initial program 53.3
Simplified53.3
Taylor expanded around inf 8.5
Final simplification10.5
herbie shell --seed 2021059
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))