\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(2 \cdot a\right) \cdot \left(-b\right) + \left(2 \cdot a\right) \cdot \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}double code(double a, double b, double c) {
return ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
double code(double a, double b, double c) {
return ((0.0 + (4.0 * (a * c))) / (((2.0 * a) * -b) + ((2.0 * a) * -sqrt(((b * b) - ((4.0 * a) * c))))));
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
Initial program 52.7
rmApplied flip-+52.7
Simplified0.4
rmApplied div-inv0.5
Applied associate-/l*0.5
Simplified0.4
rmApplied sub-neg0.4
Applied distribute-lft-in0.4
Final simplification0.4
herbie shell --seed 2020049 +o rules:numerics
(FPCore (a b c)
:name "Quadratic roots, wide range"
:precision binary64
:pre (and (< 4.9303800000000003e-32 a 2.02824e+31) (< 4.9303800000000003e-32 b 2.02824e+31) (< 4.9303800000000003e-32 c 2.02824e+31))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))