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



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < 7113.53846284254269Initial program Error: 19.0 bits
SimplifiedError: 19.0 bits
rmApplied flip--Error: 19.0 bits
SimplifiedError: 17.9 bits
SimplifiedError: 17.9 bits
if 7113.53846284254269 < b Initial program Error: 38.3 bits
SimplifiedError: 38.3 bits
Taylor expanded around inf Error: 14.9 bits
SimplifiedError: 14.8 bits
rmApplied clear-numError: 14.9 bits
SimplifiedError: 14.8 bits
Final simplificationError: 16.3 bits
herbie shell --seed 2020203
(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)))