\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 -1.3138164296877506 \cdot 10^{+98}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq -7.621813580046727 \cdot 10^{-260}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 7.7377607878944895 \cdot 10^{+96}:\\
\;\;\;\;\frac{1}{\frac{0.5}{\frac{c}{\left(-b\right) - \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 -1.3138164296877506e+98)
(- (/ c b) (/ b a))
(if (<= b -7.621813580046727e-260)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(if (<= b 7.7377607878944895e+96)
(/ 1.0 (/ 0.5 (/ 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 <= -1.3138164296877506e+98) {
tmp = (c / b) - (b / a);
} else if (b <= -7.621813580046727e-260) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (a * 2.0);
} else if (b <= 7.7377607878944895e+96) {
tmp = 1.0 / (0.5 / (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 < -1.31381642968775059e98Initial program 47.4
Taylor expanded around -inf 3.3
if -1.31381642968775059e98 < b < -7.62181358004672682e-260Initial program 8.3
if -7.62181358004672682e-260 < b < 7.7377607878944895e96Initial program 31.0
rmApplied flip-+_binary64_39731.0
Simplified16.7
rmApplied associate-/r*_binary64_36716.7
Simplified14.5
rmApplied clear-num_binary64_42214.7
Simplified10.1
if 7.7377607878944895e96 < b Initial program 59.5
Taylor expanded around inf 2.6
Simplified2.6
Final simplification6.7
herbie shell --seed 2020277
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))