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



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < 17.51350814670031Initial program 13.4
Simplified13.4
rmApplied flip--_binary64_175813.5
Simplified12.5
Simplified12.5
if 17.51350814670031 < b Initial program 33.4
Simplified33.4
Taylor expanded around inf 3.6
Simplified3.6
Final simplification5.9
herbie shell --seed 2021019
(FPCore (a b c)
:name "Cubic critical, narrow range"
:precision binary64
:pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))