\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 -2.3585860632819396 \cdot 10^{+97}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq -2.112715670541307 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 9.885898561182225 \cdot 10^{+81}:\\
\;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;-\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 -2.3585860632819396e+97)
(- (/ c b) (/ b a))
(if (<= b -2.112715670541307e-307)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(if (<= b 9.885898561182225e+81)
(* -2.0 (/ c (+ b (sqrt (- (* b b) (* c (* a 4.0)))))))
(- (/ c b))))))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) {
double tmp;
if (b <= -2.3585860632819396e+97) {
tmp = (c / b) - (b / a);
} else if (b <= -2.112715670541307e-307) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (a * 2.0);
} else if (b <= 9.885898561182225e+81) {
tmp = -2.0 * (c / (b + sqrt((b * b) - (c * (a * 4.0)))));
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.3585860632819396e97Initial program 47.0
Simplified47.0
Taylor expanded around -inf 3.6
if -2.3585860632819396e97 < b < -2.1127156705413071e-307Initial program 8.9
Simplified8.9
if -2.1127156705413071e-307 < b < 9.8858985611822248e81Initial program 32.3
Simplified32.3
rmApplied flip--_binary64_39832.3
Simplified15.9
Simplified15.9
rmApplied *-un-lft-identity_binary64_42315.9
Applied times-frac_binary64_42913.5
Applied times-frac_binary64_4298.4
Simplified8.4
Simplified8.4
if 9.8858985611822248e81 < b Initial program 58.8
Simplified58.8
Taylor expanded around inf 2.8
Simplified2.8
Final simplification6.3
herbie shell --seed 2020280
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))