\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 -4.121495107141446 \cdot 10^{+134}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 3.0932824642994295 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\
\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 -4.121495107141446e+134)
(/ (- b) a)
(if (<= b 3.0932824642994295e-69)
(/ (- (sqrt (- (* b b) (* (* a 4.0) c))) b) (* a 2.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 <= -4.121495107141446e+134) {
tmp = -b / a;
} else if (b <= 3.0932824642994295e-69) {
tmp = (sqrt((b * b) - ((a * 4.0) * c)) - b) / (a * 2.0);
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -4.1214951071414457e134Initial program 57.0
Simplified57.0
Taylor expanded around -inf 3.4
Simplified3.4
if -4.1214951071414457e134 < b < 3.0932824642994295e-69Initial program 12.8
if 3.0932824642994295e-69 < b Initial program 52.9
Simplified52.9
Taylor expanded around inf 9.2
Simplified9.2
Final simplification10.3
herbie shell --seed 2021050
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))