\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.2276371444500064 \cdot 10^{+37}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 3.7582348055294276 \cdot 10^{-87}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b}{a} \cdot 0.5\\
\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.2276371444500064e+37)
(- (/ c b) (/ b a))
(if (<= b 3.7582348055294276e-87)
(* (/ (- (sqrt (- (* b b) (* 4.0 (* c a)))) b) a) 0.5)
(- (/ 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.2276371444500064e+37) {
tmp = (c / b) - (b / a);
} else if (b <= 3.7582348055294276e-87) {
tmp = ((sqrt((b * b) - (4.0 * (c * a))) - b) / a) * 0.5;
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.22763714445000636e37Initial program 34.0
Simplified34.0
Taylor expanded around -inf 5.2
if -3.22763714445000636e37 < b < 3.7582348055294276e-87Initial program 13.5
Simplified13.5
rmApplied clear-num_binary6413.6
Simplified13.6
rmApplied associate-/r/_binary6413.6
Applied add-cube-cbrt_binary6413.6
Applied times-frac_binary6413.6
Simplified13.5
Simplified13.5
if 3.7582348055294276e-87 < b Initial program 52.1
Simplified52.1
Taylor expanded around inf 9.9
Final simplification10.4
herbie shell --seed 2021175
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))