\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \le -6.68668093917740342 \cdot 10^{275}:\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \le -2.08718180476195655 \cdot 10^{-263}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \le 3.1382336163668068 \cdot 10^{-212}:\\
\;\;\;\;\frac{1}{b2 \cdot \frac{b1}{a2 \cdot a1}}\\
\mathbf{elif}\;b1 \cdot b2 \le 9.24251358724885461 \cdot 10^{126}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\end{array}double code(double a1, double a2, double b1, double b2) {
return (((double) (a1 * a2)) / ((double) (b1 * b2)));
}
double code(double a1, double a2, double b1, double b2) {
double VAR;
if ((((double) (b1 * b2)) <= -6.686680939177403e+275)) {
VAR = ((double) ((a2 / b1) * (a1 / b2)));
} else {
double VAR_1;
if ((((double) (b1 * b2)) <= -2.0871818047619565e-263)) {
VAR_1 = ((double) (a2 * (a1 / ((double) (b1 * b2)))));
} else {
double VAR_2;
if ((((double) (b1 * b2)) <= 3.138233616366807e-212)) {
VAR_2 = (1.0 / ((double) (b2 * (b1 / ((double) (a2 * a1))))));
} else {
double VAR_3;
if ((((double) (b1 * b2)) <= 9.242513587248855e+126)) {
VAR_3 = ((double) (a2 * (a1 / ((double) (b1 * b2)))));
} else {
VAR_3 = ((double) ((a2 / b1) * (a1 / b2)));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.2 |
|---|---|
| Target | 11.0 |
| Herbie | 6.2 |
if (* b1 b2) < -6.68668093917740342e275 or 9.24251358724885461e126 < (* b1 b2) Initial program 15.8
Taylor expanded around 0 15.8
Simplified15.5
rmApplied *-un-lft-identity15.5
Applied times-frac8.0
Applied associate-*r*5.3
Simplified5.3
if -6.68668093917740342e275 < (* b1 b2) < -2.08718180476195655e-263 or 3.1382336163668068e-212 < (* b1 b2) < 9.24251358724885461e126Initial program 4.8
Taylor expanded around 0 4.8
Simplified4.8
if -2.08718180476195655e-263 < (* b1 b2) < 3.1382336163668068e-212Initial program 37.1
rmApplied clear-num37.1
Simplified17.9
Final simplification6.2
herbie shell --seed 2020182
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))