\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\begin{array}{l}
\mathbf{if}\;b_2 \leq -6.312232056986123 \cdot 10^{+152}:\\
\;\;\;\;0.5 \cdot \frac{c}{b_2} + -2 \cdot \frac{b_2}{a}\\
\mathbf{elif}\;b_2 \leq -1.4821568082008274 \cdot 10^{-280}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a} - \frac{b_2}{a}\\
\mathbf{elif}\;b_2 \leq 5.894200455189858 \cdot 10^{+70}:\\
\;\;\;\;\frac{c}{\left(-b_2\right) - \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 -6.312232056986123e+152)
(+ (* 0.5 (/ c b_2)) (* -2.0 (/ b_2 a)))
(if (<= b_2 -1.4821568082008274e-280)
(- (/ (sqrt (- (* b_2 b_2) (* c a))) a) (/ b_2 a))
(if (<= b_2 5.894200455189858e+70)
(/ 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 <= -6.312232056986123e+152) {
tmp = (0.5 * (c / b_2)) + (-2.0 * (b_2 / a));
} else if (b_2 <= -1.4821568082008274e-280) {
tmp = (sqrt((b_2 * b_2) - (c * a)) / a) - (b_2 / a);
} else if (b_2 <= 5.894200455189858e+70) {
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
| Alternative 1 | |
|---|---|
| Error | 10.0 |
| Cost | 7874 |
| Alternative 2 | |
|---|---|
| Error | 10.0 |
| Cost | 7746 |
| Alternative 3 | |
|---|---|
| Error | 13.7 |
| Cost | 7490 |
| Alternative 4 | |
|---|---|
| Error | 13.7 |
| Cost | 7426 |
| Alternative 5 | |
|---|---|
| Error | 22.6 |
| Cost | 641 |
| Alternative 6 | |
|---|---|
| Error | 39.0 |
| Cost | 641 |
| Alternative 7 | |
|---|---|
| Error | 56.0 |
| Cost | 64 |
| Alternative 8 | |
|---|---|
| Error | 61.6 |
| Cost | 64 |


if b_2 < -6.3122320569861226e152Initial program 63.3
Taylor expanded around -inf 1.9
Simplified1.9
Simplified1.9
if -6.3122320569861226e152 < b_2 < -1.48215680820082742e-280Initial program 8.0
Simplified8.0
rmApplied div-sub_binary648.0
Simplified8.0
if -1.48215680820082742e-280 < b_2 < 5.89420045518985839e70Initial program 30.6
rmApplied flip-+_binary6430.6
Simplified16.8
rmApplied *-un-lft-identity_binary6416.8
Applied *-un-lft-identity_binary6416.8
Applied times-frac_binary6416.8
Simplified16.8
Simplified10.2
Simplified10.2
if 5.89420045518985839e70 < b_2 Initial program 57.9
Simplified57.9
Taylor expanded around inf 3.3
Simplified3.3
Final simplification6.7
herbie shell --seed 2021040
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))