\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.361732391767175 \cdot 10^{+95}:\\
\;\;\;\;\frac{\left(-b_2\right) - b_2}{a}\\
\mathbf{elif}\;b_2 \leq -1.6792010575006621 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\
\mathbf{elif}\;b_2 \leq 1.1291300979796327 \cdot 10^{+98}:\\
\;\;\;\;\frac{-c}{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\end{array}(FPCore (a b_2 c) :precision binary64 (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -1.361732391767175e+95)
(/ (- (- b_2) b_2) a)
(if (<= b_2 -1.6792010575006621e-307)
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
(if (<= b_2 1.1291300979796327e+98)
(/ (- c) (+ b_2 (sqrt (- (* b_2 b_2) (* a c)))))
(* -0.5 (/ c b_2))))))double code(double a, double b_2, double c) {
return (-b_2 + sqrt((b_2 * b_2) - (a * c))) / a;
}
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.361732391767175e+95) {
tmp = (-b_2 - b_2) / a;
} else if (b_2 <= -1.6792010575006621e-307) {
tmp = (sqrt((b_2 * b_2) - (a * c)) - b_2) / a;
} else if (b_2 <= 1.1291300979796327e+98) {
tmp = -c / (b_2 + sqrt((b_2 * b_2) - (a * c)));
} else {
tmp = -0.5 * (c / b_2);
}
return tmp;
}



Bits error versus a



Bits error versus b_2



Bits error versus c
Results
if b_2 < -1.361732391767175e95Initial program 44.2
Simplified44.2
Taylor expanded around -inf 4.4
if -1.361732391767175e95 < b_2 < -1.6792010575006621e-307Initial program 9.7
if -1.6792010575006621e-307 < b_2 < 1.1291300979796327e98Initial program 32.6
Simplified32.6
rmApplied clear-num_binary6432.6
rmApplied flip--_binary6432.6
Applied associate-/r/_binary6432.7
Applied associate-/r*_binary6432.7
Simplified32.6
Taylor expanded around 0 8.4
if 1.1291300979796327e98 < b_2 Initial program 59.4
Simplified59.4
Taylor expanded around inf 2.6
Final simplification6.8
herbie shell --seed 2021027
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))