\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \le -3.0250245388054168 \cdot 10^{256}:\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \le -4.04962770169091819 \cdot 10^{-94}:\\
\;\;\;\;a1 \cdot \left(a2 \cdot \frac{\frac{1}{b2}}{b1}\right)\\
\mathbf{elif}\;b1 \cdot b2 \le 3.18800829823527456 \cdot 10^{-295}:\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \le 2.23031553909857134 \cdot 10^{300}:\\
\;\;\;\;a1 \cdot \left(a2 \cdot \frac{\frac{1}{b2}}{b1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\
\end{array}double f(double a1, double a2, double b1, double b2) {
double r117621 = a1;
double r117622 = a2;
double r117623 = r117621 * r117622;
double r117624 = b1;
double r117625 = b2;
double r117626 = r117624 * r117625;
double r117627 = r117623 / r117626;
return r117627;
}
double f(double a1, double a2, double b1, double b2) {
double r117628 = b1;
double r117629 = b2;
double r117630 = r117628 * r117629;
double r117631 = -3.025024538805417e+256;
bool r117632 = r117630 <= r117631;
double r117633 = a1;
double r117634 = r117633 / r117628;
double r117635 = a2;
double r117636 = r117634 * r117635;
double r117637 = r117636 / r117629;
double r117638 = -4.049627701690918e-94;
bool r117639 = r117630 <= r117638;
double r117640 = 1.0;
double r117641 = r117640 / r117629;
double r117642 = r117641 / r117628;
double r117643 = r117635 * r117642;
double r117644 = r117633 * r117643;
double r117645 = 3.1880082982352746e-295;
bool r117646 = r117630 <= r117645;
double r117647 = 2.2303155390985713e+300;
bool r117648 = r117630 <= r117647;
double r117649 = r117635 / r117629;
double r117650 = r117633 * r117649;
double r117651 = r117650 / r117628;
double r117652 = r117648 ? r117644 : r117651;
double r117653 = r117646 ? r117637 : r117652;
double r117654 = r117639 ? r117644 : r117653;
double r117655 = r117632 ? r117637 : r117654;
return r117655;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.9 |
|---|---|
| Target | 11.4 |
| Herbie | 5.5 |
if (* b1 b2) < -3.025024538805417e+256 or -4.049627701690918e-94 < (* b1 b2) < 3.1880082982352746e-295Initial program 24.1
rmApplied times-frac8.1
rmApplied associate-*r/7.5
if -3.025024538805417e+256 < (* b1 b2) < -4.049627701690918e-94 or 3.1880082982352746e-295 < (* b1 b2) < 2.2303155390985713e+300Initial program 5.4
rmApplied times-frac13.8
rmApplied div-inv13.8
Applied associate-*l*11.1
Simplified11.0
rmApplied *-un-lft-identity11.0
Applied div-inv11.1
Applied times-frac4.9
Simplified4.9
if 2.2303155390985713e+300 < (* b1 b2) Initial program 22.3
rmApplied times-frac2.8
rmApplied associate-*l/3.2
Final simplification5.5
herbie shell --seed 2020020 +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))