\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{3}}{a}\right)\right) \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, \left(b \cdot b\right) \cdot \left(-b\right)\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)} + b, \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}double f(double a, double b, double c) {
double r5114559 = b;
double r5114560 = -r5114559;
double r5114561 = r5114559 * r5114559;
double r5114562 = 3.0;
double r5114563 = a;
double r5114564 = r5114562 * r5114563;
double r5114565 = c;
double r5114566 = r5114564 * r5114565;
double r5114567 = r5114561 - r5114566;
double r5114568 = sqrt(r5114567);
double r5114569 = r5114560 + r5114568;
double r5114570 = r5114569 / r5114564;
return r5114570;
}
double f(double a, double b, double c) {
double r5114571 = 0.3333333333333333;
double r5114572 = a;
double r5114573 = r5114571 / r5114572;
double r5114574 = log1p(r5114573);
double r5114575 = expm1(r5114574);
double r5114576 = -3.0;
double r5114577 = c;
double r5114578 = r5114572 * r5114577;
double r5114579 = b;
double r5114580 = r5114579 * r5114579;
double r5114581 = fma(r5114576, r5114578, r5114580);
double r5114582 = sqrt(r5114581);
double r5114583 = -r5114579;
double r5114584 = r5114580 * r5114583;
double r5114585 = fma(r5114581, r5114582, r5114584);
double r5114586 = r5114582 + r5114579;
double r5114587 = fma(r5114579, r5114586, r5114581);
double r5114588 = r5114585 / r5114587;
double r5114589 = r5114575 * r5114588;
return r5114589;
}



Bits error versus a



Bits error versus b



Bits error versus c
Initial program 28.8
Simplified28.8
rmApplied flip3--28.8
Simplified28.2
Simplified28.2
rmApplied fma-neg27.5
rmApplied div-inv27.5
Simplified27.5
rmApplied expm1-log1p-u27.5
Final simplification27.5
herbie shell --seed 2019163 +o rules:numerics
(FPCore (a b c)
:name "Cubic critical, narrow range"
: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 a) c)))) (* 3 a)))