\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 -3.215444035007023 \cdot 10^{+149}:\\
\;\;\;\;-\frac{b}{a}\\
\mathbf{elif}\;b \leq -2.0438562332290375 \cdot 10^{-228}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 7.80695497130973 \cdot 10^{+98}:\\
\;\;\;\;\frac{c \cdot -2}{b + \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c}}\\
\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 -3.215444035007023e+149)
(- (/ b a))
(if (<= b -2.0438562332290375e-228)
(/ (- (sqrt (- (* b b) (* (* a 4.0) c))) b) (* a 2.0))
(if (<= b 7.80695497130973e+98)
(/ (* c -2.0) (+ b (sqrt (- (* b b) (* (* a 4.0) c)))))
(- (/ 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 <= -3.215444035007023e+149) {
tmp = -(b / a);
} else if (b <= -2.0438562332290375e-228) {
tmp = (sqrt((b * b) - ((a * 4.0) * c)) - b) / (a * 2.0);
} else if (b <= 7.80695497130973e+98) {
tmp = (c * -2.0) / (b + sqrt((b * b) - ((a * 4.0) * c)));
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.21544403500702319e149Initial program 61.9
Simplified61.9
Taylor expanded around -inf 3.1
if -3.21544403500702319e149 < b < -2.0438562332290375e-228Initial program 7.2
Simplified7.2
if -2.0438562332290375e-228 < b < 7.80695497130972954e98Initial program 30.4
Simplified30.4
rmApplied div-inv_binary6430.5
Simplified30.5
rmApplied flip--_binary6430.5
Applied associate-*l/_binary6430.6
Simplified30.6
Taylor expanded around 0 10.1
if 7.80695497130972954e98 < b Initial program 59.2
Simplified59.2
Taylor expanded around inf 2.4
Final simplification6.7
herbie shell --seed 2021118
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))