\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\frac{\frac{a \cdot 3}{\frac{b + \sqrt{\mathsf{fma}\left(\left(-c\right) \cdot a, 3, b \cdot b\right)}}{-c}}}{a \cdot 3}double f(double a, double b, double c) {
double r89266 = b;
double r89267 = -r89266;
double r89268 = r89266 * r89266;
double r89269 = 3.0;
double r89270 = a;
double r89271 = r89269 * r89270;
double r89272 = c;
double r89273 = r89271 * r89272;
double r89274 = r89268 - r89273;
double r89275 = sqrt(r89274);
double r89276 = r89267 + r89275;
double r89277 = r89276 / r89271;
return r89277;
}
double f(double a, double b, double c) {
double r89278 = a;
double r89279 = 3.0;
double r89280 = r89278 * r89279;
double r89281 = b;
double r89282 = c;
double r89283 = -r89282;
double r89284 = r89283 * r89278;
double r89285 = r89281 * r89281;
double r89286 = fma(r89284, r89279, r89285);
double r89287 = sqrt(r89286);
double r89288 = r89281 + r89287;
double r89289 = r89288 / r89283;
double r89290 = r89280 / r89289;
double r89291 = r89290 / r89280;
return r89291;
}



Bits error versus a



Bits error versus b



Bits error versus c
Initial program 52.6
Simplified52.6
rmApplied flip--52.6
Simplified0.5
Simplified0.5
rmApplied clear-num0.6
Simplified0.6
Taylor expanded around 0 0.6
Simplified0.4
rmApplied distribute-rgt-neg-in0.4
Applied *-un-lft-identity0.4
Applied times-frac0.5
Applied associate-/r*0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2019196 +o rules:numerics
(FPCore (a b c)
:name "Cubic critical, wide range"
:pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))