\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.059261012864539 \cdot 10^{+51}:\\
\;\;\;\;0.5 \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\
\mathbf{elif}\;b_2 \leq 1.0864668519398205 \cdot 10^{-267}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}{a}\\
\mathbf{elif}\;b_2 \leq 1.836614570390093 \cdot 10^{+147}:\\
\;\;\;\;\frac{-c}{b_2 + \sqrt{b_2 \cdot b_2 - c \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} - 2 \cdot \frac{b_2}{c}}\\
\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.059261012864539e+51)
(- (* 0.5 (/ c b_2)) (* 2.0 (/ b_2 a)))
(if (<= b_2 1.0864668519398205e-267)
(/ (- (sqrt (- (* b_2 b_2) (* c a))) b_2) a)
(if (<= b_2 1.836614570390093e+147)
(/ (- c) (+ b_2 (sqrt (- (* b_2 b_2) (* c a)))))
(/ 1.0 (- (* 0.5 (/ a b_2)) (* 2.0 (/ b_2 c))))))))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.059261012864539e+51) {
tmp = (0.5 * (c / b_2)) - (2.0 * (b_2 / a));
} else if (b_2 <= 1.0864668519398205e-267) {
tmp = (sqrt((b_2 * b_2) - (c * a)) - b_2) / a;
} else if (b_2 <= 1.836614570390093e+147) {
tmp = -c / (b_2 + sqrt((b_2 * b_2) - (c * a)));
} else {
tmp = 1.0 / ((0.5 * (a / b_2)) - (2.0 * (b_2 / c)));
}
return tmp;
}



Bits error versus a



Bits error versus b_2



Bits error versus c
Results
if b_2 < -1.05926101286453896e51Initial program 37.3
Simplified37.3
Taylor expanded around -inf 5.7
if -1.05926101286453896e51 < b_2 < 1.0864668519398205e-267Initial program 9.9
Simplified9.9
if 1.0864668519398205e-267 < b_2 < 1.83661457039009296e147Initial program 36.8
Simplified36.8
rmApplied flip--_binary6436.8
Simplified16.2
Simplified16.2
rmApplied *-un-lft-identity_binary6416.2
Applied *-un-lft-identity_binary6416.2
Applied *-un-lft-identity_binary6416.2
Applied times-frac_binary6416.2
Applied times-frac_binary6416.2
Simplified16.2
Simplified7.1
if 1.83661457039009296e147 < b_2 Initial program 63.3
Simplified63.3
rmApplied flip--_binary6463.3
Simplified38.6
Simplified38.6
rmApplied clear-num_binary6438.6
Simplified38.1
Taylor expanded around inf 1.8
Final simplification6.6
herbie shell --seed 2020280
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))