\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 -9.594592938143188 \cdot 10^{+113}:\\
\;\;\;\;\frac{\left(-b\right) - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 4.275038443143993 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{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 -9.594592938143188e+113)
(/ (- (- b) b) (* 3.0 a))
(if (<= b 4.275038443143993e-25)
(/ (/ (- (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 <= -9.594592938143188e+113) {
tmp = (-b - b) / (3.0 * a);
} else if (b <= 4.275038443143993e-25) {
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 < -9.59459293814318793e113Initial program 51.0
Taylor expanded in b around -inf 3.8
Simplified3.8
if -9.59459293814318793e113 < b < 4.2750384431439934e-25Initial program 15.1
Applied associate-/r*_binary6415.2
if 4.2750384431439934e-25 < b Initial program 55.0
Taylor expanded in b around inf 7.0
Final simplification10.6
herbie shell --seed 2021313
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))