\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \leq 1411.5647608647948:\\
\;\;\;\;\frac{\frac{b \cdot b - \left(b \cdot b + 4 \cdot \left(a \cdot c\right)\right)}{b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{b \cdot \frac{2}{c}}\\
\end{array}(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
:precision binary64
(if (<= b 1411.5647608647948)
(/
(/
(- (* b b) (+ (* b b) (* 4.0 (* a c))))
(+ b (sqrt (- (* b b) (* 4.0 (* a c))))))
(* a 2.0))
(/ -2.0 (* b (/ 2.0 c)))))double code(double a, double b, double c) {
return (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (4.0 * a)) * c)))))))) / ((double) (2.0 * a)));
}
double code(double a, double b, double c) {
double VAR;
if ((b <= 1411.5647608647948)) {
VAR = ((((double) (((double) (b * b)) - ((double) (((double) (b * b)) + ((double) (4.0 * ((double) (a * c)))))))) / ((double) (b + ((double) sqrt(((double) (((double) (b * b)) - ((double) (4.0 * ((double) (a * c))))))))))) / ((double) (a * 2.0)));
} else {
VAR = (-2.0 / ((double) (b * (2.0 / c))));
}
return VAR;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < 1411.56476086479483Initial program 17.5
Simplified17.5
rmApplied flip--17.4
Simplified16.5
Simplified16.5
if 1411.56476086479483 < b Initial program 36.6
Simplified36.6
Taylor expanded around inf 16.2
Simplified16.1
rmApplied associate-/l*16.2
Simplified16.2
Final simplification16.3
herbie shell --seed 2020198
(FPCore (a b c)
:name "Quadratic roots, narrow range"
:precision binary64
: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)))