\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;a1 \cdot a2 \le -1.4931232845681356 \cdot 10^{168}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;a1 \cdot a2 \le -2.0866604942007535 \cdot 10^{-124}:\\
\;\;\;\;\frac{1}{\frac{b2}{\frac{a1 \cdot a2}{b1}}}\\
\mathbf{elif}\;a1 \cdot a2 \le 1.01600999395086732 \cdot 10^{-257}:\\
\;\;\;\;\frac{\frac{\frac{a1}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \left(\sqrt[3]{a2} \cdot \sqrt[3]{a2}\right)}{\sqrt[3]{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}} \cdot \frac{\frac{\sqrt[3]{a2}}{\sqrt[3]{b1}}}{\sqrt[3]{\sqrt[3]{b2}}}\\
\mathbf{elif}\;a1 \cdot a2 \le 1.59608712487395094 \cdot 10^{126}:\\
\;\;\;\;\frac{1}{\frac{b2}{\frac{a1 \cdot a2}{b1}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a1}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \frac{\frac{a2}{\sqrt[3]{b1}}}{\sqrt[3]{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) <= -1.4931232845681356e+168)) {
temp = ((a1 / b1) * (a2 / b2));
} else {
double temp_1;
if (((a1 * a2) <= -2.0866604942007535e-124)) {
temp_1 = (1.0 / (b2 / ((a1 * a2) / b1)));
} else {
double temp_2;
if (((a1 * a2) <= 1.0160099939508673e-257)) {
temp_2 = (((((a1 / (cbrt(b1) * cbrt(b1))) / (cbrt(b2) * cbrt(b2))) * (cbrt(a2) * cbrt(a2))) / cbrt((cbrt(b2) * cbrt(b2)))) * ((cbrt(a2) / cbrt(b1)) / cbrt(cbrt(b2))));
} else {
double temp_3;
if (((a1 * a2) <= 1.596087124873951e+126)) {
temp_3 = (1.0 / (b2 / ((a1 * a2) / b1)));
} else {
temp_3 = (((a1 / (cbrt(b1) * cbrt(b1))) / (cbrt(b2) * cbrt(b2))) * ((a2 / cbrt(b1)) / cbrt(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.6 |
|---|---|
| Target | 11.3 |
| Herbie | 5.0 |
if (* a1 a2) < -1.4931232845681356e+168Initial program 30.4
rmApplied times-frac12.5
if -1.4931232845681356e+168 < (* a1 a2) < -2.0866604942007535e-124 or 1.0160099939508673e-257 < (* a1 a2) < 1.596087124873951e+126Initial program 4.0
rmApplied associate-/r*3.7
rmApplied clear-num4.1
if -2.0866604942007535e-124 < (* a1 a2) < 1.0160099939508673e-257Initial program 14.7
rmApplied associate-/r*14.7
rmApplied add-cube-cbrt15.0
Applied add-cube-cbrt15.1
Applied times-frac8.4
Applied times-frac3.5
rmApplied add-cube-cbrt3.5
Applied cbrt-prod3.6
Applied *-un-lft-identity3.6
Applied add-cube-cbrt3.6
Applied times-frac3.6
Applied times-frac3.0
Applied associate-*r*3.0
Simplified3.0
if 1.596087124873951e+126 < (* a1 a2) Initial program 25.3
rmApplied associate-/r*27.1
rmApplied add-cube-cbrt27.7
Applied add-cube-cbrt27.8
Applied times-frac17.4
Applied times-frac9.4
Final simplification5.0
herbie shell --seed 2020056 +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))