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



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < 594.51042316339453Initial program 16.6
Simplified16.6
rmApplied flip--_binary6416.6
Simplified15.6
Simplified15.6
if 594.51042316339453 < b Initial program 36.1
Simplified36.1
Taylor expanded around inf 16.5
rmApplied associate-/l*_binary6416.5
Simplified16.4
rmApplied div-inv_binary6416.5
Applied *-un-lft-identity_binary6416.5
Applied times-frac_binary6416.5
Applied *-un-lft-identity_binary6416.5
Applied times-frac_binary6416.5
Simplified16.5
Simplified16.5
Final simplification16.1
herbie shell --seed 2020219
(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)))