\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\frac{4 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \frac{1}{2}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 (((4.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c))))) * (1.0 / 2.0));
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
Initial program 52.7
rmApplied flip-+52.7
Simplified0.4
rmApplied *-commutative0.4
Applied div-inv0.4
Applied times-frac0.4
rmApplied div-inv0.4
Applied associate-*r*0.4
Simplified0.2
Taylor expanded around 0 0.1
Final simplification0.1
herbie shell --seed 2020071 +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)))