\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \leq -5.562117873525825 \cdot 10^{+190}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq -1.6952518629488907 \cdot 10^{-183}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 8.602609044046132 \cdot 10^{-236} \lor \neg \left(b1 \cdot b2 \leq 1.3186271336181104 \cdot 10^{+160}\right):\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\mathbf{else}:\\
\;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\
\end{array}(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(if (<= (* b1 b2) -5.562117873525825e+190)
(* (/ a1 b1) (/ a2 b2))
(if (<= (* b1 b2) -1.6952518629488907e-183)
(/ (* a1 a2) (* b1 b2))
(if (or (<= (* b1 b2) 8.602609044046132e-236)
(not (<= (* b1 b2) 1.3186271336181104e+160)))
(/ (* (/ a1 b1) a2) b2)
(* a1 (/ a2 (* b1 b2)))))))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 tmp;
if ((b1 * b2) <= -5.562117873525825e+190) {
tmp = (a1 / b1) * (a2 / b2);
} else if ((b1 * b2) <= -1.6952518629488907e-183) {
tmp = (a1 * a2) / (b1 * b2);
} else if (((b1 * b2) <= 8.602609044046132e-236) || !((b1 * b2) <= 1.3186271336181104e+160)) {
tmp = ((a1 / b1) * a2) / b2;
} else {
tmp = a1 * (a2 / (b1 * b2));
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 10.9 |
|---|---|
| Target | 11.7 |
| Herbie | 5.2 |
if (*.f64 b1 b2) < -5.5621178735258251e190Initial program 14.8
rmApplied times-frac_binary64_38474.4
if -5.5621178735258251e190 < (*.f64 b1 b2) < -1.6952518629488907e-183Initial program 3.9
if -1.6952518629488907e-183 < (*.f64 b1 b2) < 8.6026090440461317e-236 or 1.3186271336181104e160 < (*.f64 b1 b2) Initial program 21.8
rmApplied associate-/r*_binary64_378511.5
Simplified7.9
if 8.6026090440461317e-236 < (*.f64 b1 b2) < 1.3186271336181104e160Initial program 4.6
rmApplied div-inv_binary64_38384.6
rmApplied associate-*l*_binary64_37824.1
Simplified4.0
Final simplification5.2
herbie shell --seed 2020281
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))