\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 -7.0486931181595724 \cdot 10^{+72}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 6.842931416474762 \cdot 10^{+56}:\\
\;\;\;\;\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 -7.0486931181595724e+72)
(/ (- b) a)
(if (<= b 6.842931416474762e+56)
(/ (- (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 <= -7.0486931181595724e+72) {
tmp = -b / a;
} else if (b <= 6.842931416474762e+56) {
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 < -7.0486931181595724e72Initial program 41.3
Simplified41.3
Taylor expanded around -inf 4.8
Simplified4.8
if -7.0486931181595724e72 < b < 6.84293141647476195e56Initial program 19.1
Simplified19.1
if 6.84293141647476195e56 < b Initial program 57.9
Simplified57.9
Taylor expanded around inf 3.5
Simplified3.5
Final simplification12.3
herbie shell --seed 2020353
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))