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



Bits error versus a



Bits error versus b



Bits error versus c
if b < 0.0103340776952827677Initial program 8.4
Applied flip3-+_binary648.5
if 0.0103340776952827677 < b Initial program 30.7
Taylor expanded in b around inf 5.1
Simplified5.1
Taylor expanded in c around 0 4.9
Simplified4.9
Final simplification5.1
herbie shell --seed 2021216
(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)))