\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 -19862.42266342159:\\
\;\;\;\;\mathsf{fma}\left(\frac{-3 \cdot c}{b}, -0.16666666666666666, \frac{b}{a} \cdot -0.6666666666666666\right)\\
\mathbf{elif}\;b \leq 7.69231311753423 \cdot 10^{-110}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \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 -19862.42266342159)
(fma (/ (* -3.0 c) b) -0.16666666666666666 (* (/ b a) -0.6666666666666666))
(if (<= b 7.69231311753423e-110)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 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 <= -19862.42266342159) {
tmp = fma(((-3.0 * c) / b), -0.16666666666666666, ((b / a) * -0.6666666666666666));
} else if (b <= 7.69231311753423e-110) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -19862.422663421588Initial program 33.5
Applied frac-2neg_binary6433.5
Simplified33.5
Simplified33.5
Taylor expanded in b around -inf 36.7
Simplified7.6
if -19862.422663421588 < b < 7.6923131175342304e-110Initial program 13.9
if 7.6923131175342304e-110 < b Initial program 51.8
Taylor expanded in b around inf 10.5
Final simplification11.0
herbie shell --seed 2022097
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))