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



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < 0.75957660799974724Initial program 11.5
Simplified11.5
rmApplied flip--_binary6411.5
Simplified10.5
Simplified10.5
if 0.75957660799974724 < b Initial program 32.0
Simplified32.0
Taylor expanded around inf 4.5
Simplified4.5
rmApplied *-un-lft-identity_binary644.5
Applied times-frac_binary644.5
Simplified4.5
Simplified4.5
Taylor expanded around 0 4.2
Simplified4.2
Final simplification5.1
herbie shell --seed 2021205
(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)))