\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\frac{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, -a \cdot 4, b \cdot b\right)}} \cdot \frac{a \cdot 4}{2}}{a}double f(double a, double b, double c) {
double r47229 = b;
double r47230 = -r47229;
double r47231 = r47229 * r47229;
double r47232 = 4.0;
double r47233 = a;
double r47234 = r47232 * r47233;
double r47235 = c;
double r47236 = r47234 * r47235;
double r47237 = r47231 - r47236;
double r47238 = sqrt(r47237);
double r47239 = r47230 + r47238;
double r47240 = 2.0;
double r47241 = r47240 * r47233;
double r47242 = r47239 / r47241;
return r47242;
}
double f(double a, double b, double c) {
double r47243 = c;
double r47244 = b;
double r47245 = -r47244;
double r47246 = a;
double r47247 = 4.0;
double r47248 = r47246 * r47247;
double r47249 = -r47248;
double r47250 = r47244 * r47244;
double r47251 = fma(r47243, r47249, r47250);
double r47252 = sqrt(r47251);
double r47253 = r47245 - r47252;
double r47254 = r47243 / r47253;
double r47255 = 2.0;
double r47256 = r47248 / r47255;
double r47257 = r47254 * r47256;
double r47258 = r47257 / r47246;
return r47258;
}



Bits error versus a



Bits error versus b



Bits error versus c
Initial program 28.7
rmApplied flip-+28.7
Simplified0.5
Simplified0.5
rmApplied add-sqr-sqrt0.5
Applied rem-sqrt-square0.5
rmApplied add-sqr-sqrt0.5
Applied distribute-lft-neg-in0.5
Applied fma-neg0.5
Simplified0.5
rmApplied associate-/r*0.5
Simplified0.3
Final simplification0.3
herbie shell --seed 2019196 +o rules:numerics
(FPCore (a b c)
:name "Quadratic roots, 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) (* (* 4.0 a) c)))) (* 2.0 a)))