\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.9705234342937443:\\
\;\;\;\;\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}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\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.9705234342937443)
(/
(/
(- (- (* b b) (* (* 3.0 a) c)) (* b b))
(+ b (sqrt (- (* b b) (* (* 3.0 a) c)))))
(* 3.0 a))
(* -0.5 (/ c b))))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.9705234342937443)) {
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) (-0.5 * (c / b)));
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < 0.97052343429374432Initial program 25.1
Simplified25.1
rmApplied flip--_binary6425.1
Simplified24.1
Simplified24.1
if 0.97052343429374432 < b Initial program 47.6
Simplified47.6
Taylor expanded around inf 9.2
Final simplification11.6
herbie shell --seed 2020210
(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)))