\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;a1 \cdot a2 \le -6.08712058696868874 \cdot 10^{188}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\
\mathbf{elif}\;a1 \cdot a2 \le -3.0178565167744215 \cdot 10^{-307}:\\
\;\;\;\;\left(a2 \cdot a1\right) \cdot \frac{\frac{1}{b2}}{b1}\\
\mathbf{elif}\;a1 \cdot a2 \le 5.3291942180717 \cdot 10^{-313}:\\
\;\;\;\;\frac{\sqrt[3]{a1} \cdot \sqrt[3]{a1}}{1} \cdot \left(\frac{\sqrt[3]{a1}}{b1} \cdot \frac{a2}{b2}\right)\\
\mathbf{elif}\;a1 \cdot a2 \le 4.48816418979761226 \cdot 10^{154}:\\
\;\;\;\;\left(a2 \cdot a1\right) \cdot \frac{\frac{1}{b2}}{b1}\\
\mathbf{else}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\
\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) <= -6.087120586968689e+188)) {
temp = (a1 * ((a2 / b2) / b1));
} else {
double temp_1;
if (((a1 * a2) <= -3.0178565167744215e-307)) {
temp_1 = ((a2 * a1) * ((1.0 / b2) / b1));
} else {
double temp_2;
if (((a1 * a2) <= 5.3291942180717e-313)) {
temp_2 = (((cbrt(a1) * cbrt(a1)) / 1.0) * ((cbrt(a1) / b1) * (a2 / b2)));
} else {
double temp_3;
if (((a1 * a2) <= 4.488164189797612e+154)) {
temp_3 = ((a2 * a1) * ((1.0 / b2) / b1));
} else {
temp_3 = (a1 * ((a2 / b2) / b1));
}
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.3 |
|---|---|
| Target | 11.7 |
| Herbie | 5.0 |
if (* a1 a2) < -6.087120586968689e+188 or 4.488164189797612e+154 < (* a1 a2) Initial program 31.5
rmApplied times-frac11.2
rmApplied div-inv11.2
Applied associate-*l*9.8
Simplified9.8
if -6.087120586968689e+188 < (* a1 a2) < -3.0178565167744215e-307 or 5.3291942180717e-313 < (* a1 a2) < 4.488164189797612e+154Initial program 4.5
rmApplied times-frac13.9
rmApplied div-inv13.9
Applied associate-*l*13.6
Simplified13.5
rmApplied *-un-lft-identity13.5
Applied div-inv13.6
Applied times-frac10.3
Applied associate-*r*4.6
Simplified4.6
if -3.0178565167744215e-307 < (* a1 a2) < 5.3291942180717e-313Initial program 21.6
rmApplied times-frac2.9
rmApplied *-un-lft-identity2.9
Applied add-cube-cbrt3.2
Applied times-frac3.2
Applied associate-*l*2.4
Final simplification5.0
herbie shell --seed 2020049 +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))