\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.008923916934394698:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(a \cdot -1.5\right) \cdot \frac{c}{b}}{3 \cdot a}\\
\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.008923916934394698)
(/
(/
(- (- (* b b) (* (* 3.0 a) c)) (* b b))
(+ b (sqrt (- (* b b) (* (* 3.0 a) c)))))
(* 3.0 a))
(/ (* (* a -1.5) (/ c b)) (* 3.0 a))))double code(double a, double b, double c) {
return (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))) / ((double) (3.0 * a)));
}
double code(double a, double b, double c) {
double tmp;
if ((b <= 0.008923916934394698)) {
tmp = ((((double) (((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))) - ((double) (b * b)))) / ((double) (b + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c))))))))) / ((double) (3.0 * a)));
} else {
tmp = (((double) (((double) (a * -1.5)) * (c / b))) / ((double) (3.0 * a)));
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < 0.0089239169343946975Initial program 21.8
Simplified21.8
rmApplied flip--_binary6421.7
Simplified20.7
Simplified20.7
if 0.0089239169343946975 < b Initial program 46.8
Simplified46.8
Taylor expanded around inf 10.2
rmApplied *-un-lft-identity_binary6410.2
Applied times-frac_binary6410.1
Applied associate-*r*_binary649.9
Simplified9.9
Final simplification11.0
herbie shell --seed 2020219
(FPCore (a b c)
:name "Cubic critical, medium range"
:precision binary64
:pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))