\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\begin{array}{l}
\mathbf{if}\;b_2 \leq -4.2520876202821275 \cdot 10^{+149}:\\
\;\;\;\;0.5 \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\
\mathbf{elif}\;b_2 \leq -4.919868612892665 \cdot 10^{-308}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}{a}\\
\mathbf{elif}\;b_2 \leq 5.04095014286866 \cdot 10^{+139}:\\
\;\;\;\;-\frac{c}{b_2 + \sqrt{b_2 \cdot b_2 - c \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\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 -4.2520876202821275e+149)
(- (* 0.5 (/ c b_2)) (* 2.0 (/ b_2 a)))
(if (<= b_2 -4.919868612892665e-308)
(/ (- (sqrt (- (* b_2 b_2) (* c a))) b_2) a)
(if (<= b_2 5.04095014286866e+139)
(- (/ c (+ b_2 (sqrt (- (* b_2 b_2) (* c a))))))
(* (/ c b_2) -0.5)))))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 <= -4.2520876202821275e+149) {
tmp = (0.5 * (c / b_2)) - (2.0 * (b_2 / a));
} else if (b_2 <= -4.919868612892665e-308) {
tmp = (sqrt((b_2 * b_2) - (c * a)) - b_2) / a;
} else if (b_2 <= 5.04095014286866e+139) {
tmp = -(c / (b_2 + sqrt((b_2 * b_2) - (c * a))));
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b_2



Bits error versus c
Results
if b_2 < -4.25208762028212747e149Initial program 62.7
Simplified62.7
Taylor expanded around -inf 1.8
if -4.25208762028212747e149 < b_2 < -4.91986861289266545e-308Initial program 8.4
if -4.91986861289266545e-308 < b_2 < 5.04095014286865951e139Initial program 33.5
Simplified33.5
rmApplied flip--_binary6433.5
Simplified15.9
Simplified15.9
rmApplied distribute-frac-neg_binary6415.9
Applied distribute-frac-neg_binary6415.9
Simplified8.1
if 5.04095014286865951e139 < b_2 Initial program 62.6
Simplified62.6
Taylor expanded around inf 1.3
Final simplification6.2
herbie shell --seed 2020354
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))