\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -8.9003811474607525 \cdot 10^{-304}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -0.0:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 3.76518302081690468 \cdot 10^{299}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\end{array}double code(double a1, double a2, double b1, double b2) {
return ((a1 * a2) / (b1 * b2));
}
double code(double a1, double a2, double b1, double b2) {
double temp;
if ((((a1 * a2) / (b1 * b2)) <= -inf.0)) {
temp = ((a1 * (a2 / b2)) / b1);
} else {
double temp_1;
if ((((a1 * a2) / (b1 * b2)) <= -8.900381147460752e-304)) {
temp_1 = ((a1 * a2) / (b1 * b2));
} else {
double temp_2;
if ((((a1 * a2) / (b1 * b2)) <= -0.0)) {
temp_2 = ((a1 / b1) * (a2 / b2));
} else {
double temp_3;
if ((((a1 * a2) / (b1 * b2)) <= 3.765183020816905e+299)) {
temp_3 = ((a1 * a2) / (b1 * b2));
} else {
temp_3 = ((a1 / b1) * (a2 / b2));
}
temp_2 = temp_3;
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.4 |
|---|---|
| Target | 11.6 |
| Herbie | 2.2 |
if (/ (* a1 a2) (* b1 b2)) < -inf.0Initial program 64.0
rmApplied times-frac11.6
rmApplied associate-*l/16.8
if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -8.900381147460752e-304 or -0.0 < (/ (* a1 a2) (* b1 b2)) < 3.765183020816905e+299Initial program 0.8
rmApplied times-frac17.3
rmApplied frac-times0.8
if -8.900381147460752e-304 < (/ (* a1 a2) (* b1 b2)) < -0.0 or 3.765183020816905e+299 < (/ (* a1 a2) (* b1 b2)) Initial program 22.9
rmApplied times-frac3.1
Final simplification2.2
herbie shell --seed 2020066
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))