\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 0.00837895543527296:\\
\;\;\;\;\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}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\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 0.00837895543527296)
(/
(/
(- (* b b) (+ (* b b) (* 4.0 (* a c))))
(+ b (sqrt (- (* b b) (* 4.0 (* a c))))))
(* a 2.0))
(* -1.0 (/ c b))))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 <= 0.00837895543527296)) {
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 = ((double) (-1.0 * (c / b)));
}
return VAR;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < 0.0083789554352729605Initial program 20.8
Simplified20.8
rmApplied flip--20.9
Simplified19.9
Simplified19.9
if 0.0083789554352729605 < b Initial program 46.4
Simplified46.4
Taylor expanded around inf 10.1
Final simplification11.1
herbie shell --seed 2020198
(FPCore (a b c)
:name "Quadratic roots, medium range"
:precision binary64
:pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))