\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 -1.0187968088253477 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq -4.0088356050405405 \cdot 10^{-270}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 8.64278930394556 \cdot 10^{-27}:\\
\;\;\;\;\frac{a}{a} \cdot \frac{-c}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\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 -1.0187968088253477e+144)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b -4.0088356050405405e-270)
(/ (- (sqrt (fma b b (* c (* a -3.0)))) b) (* a 3.0))
(if (<= b 8.64278930394556e-27)
(* (/ a a) (/ (- c) (+ b (hypot b (sqrt (* a (* c -3.0)))))))
(* (/ c b) -0.5)))))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 <= -1.0187968088253477e+144) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= -4.0088356050405405e-270) {
tmp = (sqrt(fma(b, b, (c * (a * -3.0)))) - b) / (a * 3.0);
} else if (b <= 8.64278930394556e-27) {
tmp = (a / a) * (-c / (b + hypot(b, sqrt(a * (c * -3.0)))));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -1.0187968088253477e144Initial program 59.6
rmApplied flip-+_binary6464.0
Simplified62.8
Simplified62.8
Taylor expanded in b around -inf 2.3
Simplified2.3
if -1.0187968088253477e144 < b < -4.0088356050405405e-270Initial program 8.9
rmApplied fma-neg_binary648.9
Simplified8.9
if -4.0088356050405405e-270 < b < 8.6427893039455601e-27Initial program 22.5
Simplified22.7
rmApplied flip--_binary6422.8
Applied frac-times_binary6428.7
Simplified24.1
Simplified24.1
Taylor expanded in a around 0 24.1
Simplified12.5
if 8.6427893039455601e-27 < b Initial program 55.0
rmApplied flip-+_binary6455.0
Simplified26.6
Simplified26.6
Taylor expanded in c around 0 6.5
Final simplification8.1
herbie shell --seed 2021212
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))