\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 0.023162534011369054:\\
\;\;\;\;\begin{array}{l}
t_0 := \sqrt[3]{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\\
t_0 \cdot \left(t_0 \cdot t_0\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(0.5625, \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}}, \mathsf{fma}\left(1.0546875, \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}}, \mathsf{fma}\left(0.5, \frac{c}{b}, 0.375 \cdot \frac{c \cdot \left(a \cdot c\right)}{{b}^{3}}\right)\right)\right)\\
\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 0.023162534011369054)
(let* ((t_0 (cbrt (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)))))
(* t_0 (* t_0 t_0)))
(-
(fma
0.5625
(/ (* (* a a) (pow c 3.0)) (pow b 5.0))
(fma
1.0546875
(/ (* (pow a 3.0) (pow c 4.0)) (pow b 7.0))
(fma 0.5 (/ c b) (* 0.375 (/ (* c (* a c)) (pow b 3.0)))))))))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 <= 0.023162534011369054) {
double t_0_1 = cbrt((sqrt((b * b) - ((3.0 * a) * c)) - b) / (3.0 * a));
tmp = t_0_1 * (t_0_1 * t_0_1);
} else {
tmp = -fma(0.5625, (((a * a) * pow(c, 3.0)) / pow(b, 5.0)), fma(1.0546875, ((pow(a, 3.0) * pow(c, 4.0)) / pow(b, 7.0)), fma(0.5, (c / b), (0.375 * ((c * (a * c)) / pow(b, 3.0))))));
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < 0.0231625340113690535Initial program 9.1
Applied add-cube-cbrt_binary649.2
if 0.0231625340113690535 < b Initial program 30.5
Taylor expanded in b around inf 5.0
Simplified5.0
Final simplification5.3
herbie shell --seed 2021224
(FPCore (a b c)
:name "Cubic critical, narrow range"
:precision binary64
:pre (and (< 1.0536712127723509e-8 a 94906265.62425156) (< 1.0536712127723509e-8 b 94906265.62425156) (< 1.0536712127723509e-8 c 94906265.62425156))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))