\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -6.6844398141843 \cdot 10^{-312}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{\frac{1}{b1}}{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 8.55317884451173137 \cdot 10^{276}:\\
\;\;\;\;\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 / b1) * (a2 / b2));
} else {
double temp_1;
if ((((a1 * a2) / (b1 * b2)) <= -6.6844398141843e-312)) {
temp_1 = ((a1 * a2) * ((1.0 / 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)) <= 8.553178844511731e+276)) {
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.5 |
| Herbie | 2.5 |
if (/ (* a1 a2) (* b1 b2)) < -inf.0 or -6.6844398141843e-312 < (/ (* a1 a2) (* b1 b2)) < 0.0 or 8.553178844511731e+276 < (/ (* a1 a2) (* b1 b2)) Initial program 25.7
rmApplied times-frac4.3
if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -6.6844398141843e-312Initial program 0.9
rmApplied associate-/r*8.9
rmApplied *-un-lft-identity8.9
Applied div-inv9.0
Applied times-frac1.4
Simplified1.4
if 0.0 < (/ (* a1 a2) (* b1 b2)) < 8.553178844511731e+276Initial program 0.8
Final simplification2.5
herbie shell --seed 2020065
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))