\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 -7.518753900645323 \cdot 10^{+128}:\\
\;\;\;\;\frac{\left(-b\right) - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 7.17628680422661 \cdot 10^{-166}:\\
\;\;\;\;\frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} - b}{3}}{a}\\
\mathbf{elif}\;b \leq 6606110945.941845:\\
\;\;\;\;\frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -3\right)}, b\right)}}{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 -7.518753900645323e+128)
(/ (- (- b) b) (* 3.0 a))
(if (<= b 7.17628680422661e-166)
(/ (/ (- (sqrt (fma (* a c) -3.0 (* b b))) b) 3.0) a)
(if (<= b 6606110945.941845)
(/
(/ (* 3.0 (* a c)) (- (- b) (hypot (sqrt (* c (* a -3.0))) 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 <= -7.518753900645323e+128) {
tmp = (-b - b) / (3.0 * a);
} else if (b <= 7.17628680422661e-166) {
tmp = ((sqrt(fma((a * c), -3.0, (b * b))) - b) / 3.0) / a;
} else if (b <= 6606110945.941845) {
tmp = ((3.0 * (a * c)) / (-b - hypot(sqrt(c * (a * -3.0)), b))) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -7.51875390064532329e128Initial program 53.9
Taylor expanded in b around -inf 2.9
Simplified2.9
if -7.51875390064532329e128 < b < 7.17628680422661011e-166Initial program 10.6
Taylor expanded in b around 0 10.6
Simplified10.6
Applied associate-/r*_binary6410.6
if 7.17628680422661011e-166 < b < 6606110945.9418449Initial program 31.9
Applied flip-+_binary6431.9
Simplified17.8
Simplified25.5
if 6606110945.9418449 < b Initial program 57.0
Taylor expanded in b around 0 57.0
Simplified57.0
Taylor expanded in b around inf 5.3
Final simplification10.0
herbie shell --seed 2021275
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))