\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \le -4.452289351512009238820999151564290328377 \cdot 10^{155}:\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \le -1.127744605900062648278972986449983094423 \cdot 10^{-225}:\\
\;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\
\mathbf{elif}\;b1 \cdot b2 \le 1.537569596993452221139681688403437084805 \cdot 10^{-155}:\\
\;\;\;\;\frac{\frac{a1}{b1}}{\frac{b2}{a2}}\\
\mathbf{elif}\;b1 \cdot b2 \le 2.335339068356238477311146561514236710862 \cdot 10^{283}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\end{array}double f(double a1, double a2, double b1, double b2) {
double r120680 = a1;
double r120681 = a2;
double r120682 = r120680 * r120681;
double r120683 = b1;
double r120684 = b2;
double r120685 = r120683 * r120684;
double r120686 = r120682 / r120685;
return r120686;
}
double f(double a1, double a2, double b1, double b2) {
double r120687 = b1;
double r120688 = b2;
double r120689 = r120687 * r120688;
double r120690 = -4.452289351512009e+155;
bool r120691 = r120689 <= r120690;
double r120692 = a1;
double r120693 = r120692 / r120687;
double r120694 = a2;
double r120695 = r120693 * r120694;
double r120696 = r120695 / r120688;
double r120697 = -1.1277446059000626e-225;
bool r120698 = r120689 <= r120697;
double r120699 = r120692 * r120694;
double r120700 = r120688 * r120687;
double r120701 = r120699 / r120700;
double r120702 = 1.5375695969934522e-155;
bool r120703 = r120689 <= r120702;
double r120704 = r120688 / r120694;
double r120705 = r120693 / r120704;
double r120706 = 2.3353390683562385e+283;
bool r120707 = r120689 <= r120706;
double r120708 = r120689 / r120694;
double r120709 = r120692 / r120708;
double r120710 = r120707 ? r120709 : r120696;
double r120711 = r120703 ? r120705 : r120710;
double r120712 = r120698 ? r120701 : r120711;
double r120713 = r120691 ? r120696 : r120712;
return r120713;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.3 |
|---|---|
| Target | 10.9 |
| Herbie | 5.1 |
if (* b1 b2) < -4.452289351512009e+155 or 2.3353390683562385e+283 < (* b1 b2) Initial program 16.7
rmApplied times-frac4.6
rmApplied div-inv4.7
Applied associate-*r*4.6
rmApplied un-div-inv4.5
if -4.452289351512009e+155 < (* b1 b2) < -1.1277446059000626e-225Initial program 4.0
rmApplied times-frac15.0
rmApplied div-inv15.0
Applied associate-*r*15.7
rmApplied associate-*l/11.7
Applied frac-times4.0
Simplified4.0
Simplified4.0
if -1.1277446059000626e-225 < (* b1 b2) < 1.5375695969934522e-155Initial program 30.2
rmApplied times-frac10.5
rmApplied div-inv10.5
Applied associate-*r*10.1
rmApplied un-div-inv10.0
rmApplied associate-/l*10.0
if 1.5375695969934522e-155 < (* b1 b2) < 2.3353390683562385e+283Initial program 4.6
rmApplied associate-/l*4.3
Final simplification5.1
herbie shell --seed 2019326 +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))