\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.044587333497852823924878268479973587724 \cdot 10^{-294}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 0.0:\\
\;\;\;\;\frac{1}{\frac{b1}{a1} \cdot \frac{b2}{a2}}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 3.005399214482244746567528503375041565374 \cdot 10^{300}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{b1}}{\frac{b2}{a1}} \cdot a2\\
\end{array}double f(double a1, double a2, double b1, double b2) {
double r119991 = a1;
double r119992 = a2;
double r119993 = r119991 * r119992;
double r119994 = b1;
double r119995 = b2;
double r119996 = r119994 * r119995;
double r119997 = r119993 / r119996;
return r119997;
}
double f(double a1, double a2, double b1, double b2) {
double r119998 = a1;
double r119999 = a2;
double r120000 = r119998 * r119999;
double r120001 = b1;
double r120002 = b2;
double r120003 = r120001 * r120002;
double r120004 = r120000 / r120003;
double r120005 = -1.0445873334978528e-294;
bool r120006 = r120004 <= r120005;
double r120007 = 0.0;
bool r120008 = r120004 <= r120007;
double r120009 = 1.0;
double r120010 = r120001 / r119998;
double r120011 = r120002 / r119999;
double r120012 = r120010 * r120011;
double r120013 = r120009 / r120012;
double r120014 = 3.005399214482245e+300;
bool r120015 = r120004 <= r120014;
double r120016 = r120009 / r120001;
double r120017 = r120002 / r119998;
double r120018 = r120016 / r120017;
double r120019 = r120018 * r119999;
double r120020 = r120015 ? r120004 : r120019;
double r120021 = r120008 ? r120013 : r120020;
double r120022 = r120006 ? r120004 : r120021;
return r120022;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.4 |
|---|---|
| Target | 11.3 |
| Herbie | 4.9 |
if (/ (* a1 a2) (* b1 b2)) < -1.0445873334978528e-294 or 0.0 < (/ (* a1 a2) (* b1 b2)) < 3.005399214482245e+300Initial program 4.5
if -1.0445873334978528e-294 < (/ (* a1 a2) (* b1 b2)) < 0.0Initial program 14.0
rmApplied clear-num14.4
Simplified3.5
rmApplied pow13.5
Applied pow13.5
Applied pow-prod-down3.5
Simplified3.8
if 3.005399214482245e+300 < (/ (* a1 a2) (* b1 b2)) Initial program 61.7
rmApplied clear-num61.7
Simplified6.4
rmApplied associate-*r/13.4
Applied associate-/r/13.8
Simplified13.6
Final simplification4.9
herbie shell --seed 2019179 +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))