\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\mathsf{fma}\left(\frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}}, -1.0546875, \mathsf{fma}\left(\frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, -0.5625, \mathsf{fma}\left(\frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}, -0.375, -0.5 \cdot \frac{c}{b}\right)\right)\right)
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c) :precision binary64 (fma (/ (* (pow a 3.0) (pow c 4.0)) (pow b 7.0)) -1.0546875 (fma (/ (* (pow c 3.0) (* a a)) (pow b 5.0)) -0.5625 (fma (/ (* a (* c c)) (pow b 3.0)) -0.375 (* -0.5 (/ c b))))))
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) {
return fma(((pow(a, 3.0) * pow(c, 4.0)) / pow(b, 7.0)), -1.0546875, fma(((pow(c, 3.0) * (a * a)) / pow(b, 5.0)), -0.5625, fma(((a * (c * c)) / pow(b, 3.0)), -0.375, (-0.5 * (c / b)))));
}



Bits error versus a



Bits error versus b



Bits error versus c
Initial program 52.6
Taylor expanded in b around inf 1.8
Simplified1.8
Taylor expanded in c around 0 1.4
Simplified1.4
Final simplification1.4
herbie shell --seed 2021275
(FPCore (a b c)
:name "Cubic critical, wide range"
:precision binary64
:pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))