\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \leq -9.131732657146973 \cdot 10^{+152}:\\
\;\;\;\;\frac{\left(-b_2\right) - b_2}{a}\\
\mathbf{elif}\;b_2 \leq 1.7908910694223973 \cdot 10^{-96}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\
\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 -9.131732657146973e+152)
(/ (- (- b_2) b_2) a)
(if (<= b_2 1.7908910694223973e-96)
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
(* -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 <= -9.131732657146973e+152) {
tmp = (-b_2 - b_2) / a;
} else if (b_2 <= 1.7908910694223973e-96) {
tmp = (sqrt((b_2 * b_2) - (a * c)) - b_2) / a;
} 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 < -9.1317326571469729e152Initial program 63.7
Simplified63.7
Applied div-inv_binary6463.7
Applied pow1_binary6463.7
Applied pow1_binary6463.7
Applied pow-prod-down_binary6463.7
Simplified37.5
Taylor expanded in b_2 around -inf 2.4
Simplified2.4
if -9.1317326571469729e152 < b_2 < 1.7908910694223973e-96Initial program 11.1
if 1.7908910694223973e-96 < b_2 Initial program 53.1
Simplified53.1
Taylor expanded in b_2 around inf 9.5
Final simplification9.5
herbie shell --seed 2021344
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))