\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \leq -1.1355012678726789 \cdot 10^{+153}:\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq -9.263253492303025 \cdot 10^{-118}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq -1.1211162412311246 \cdot 10^{-221}:\\
\;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq -1.529547355389986 \cdot 10^{-272}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 7.5262322703101 \cdot 10^{-156} \lor \neg \left(b1 \cdot b2 \leq 2.162641445803541 \cdot 10^{+144}\right):\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{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) -1.1355012678726789e+153)
(* (/ a2 b1) (/ a1 b2))
(if (<= (* b1 b2) -9.263253492303025e-118)
(* a2 (/ a1 (* b1 b2)))
(if (<= (* b1 b2) -1.1211162412311246e-221)
(* a1 (/ a2 (* b1 b2)))
(if (<= (* b1 b2) -1.529547355389986e-272)
(* a2 (/ a1 (* b1 b2)))
(if (or (<= (* b1 b2) 7.5262322703101e-156)
(not (<= (* b1 b2) 2.162641445803541e+144)))
(* (/ a2 b1) (/ a1 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) <= -1.1355012678726789e+153) {
tmp = (a2 / b1) * (a1 / b2);
} else if ((b1 * b2) <= -9.263253492303025e-118) {
tmp = a2 * (a1 / (b1 * b2));
} else if ((b1 * b2) <= -1.1211162412311246e-221) {
tmp = a1 * (a2 / (b1 * b2));
} else if ((b1 * b2) <= -1.529547355389986e-272) {
tmp = a2 * (a1 / (b1 * b2));
} else if (((b1 * b2) <= 7.5262322703101e-156) || !((b1 * b2) <= 2.162641445803541e+144)) {
tmp = (a2 / b1) * (a1 / 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 | 11.5 |
|---|---|
| Target | 11.0 |
| Herbie | 5.3 |
if (*.f64 b1 b2) < -1.13550126787267889e153 or -1.5295473553899859e-272 < (*.f64 b1 b2) < 7.5262322703101004e-156 or 2.1626414458035412e144 < (*.f64 b1 b2) Initial program 18.7
rmApplied associate-/l*_binary6418.3
Simplified10.8
rmApplied associate-/r/_binary6410.6
Applied *-un-lft-identity_binary6410.6
Applied times-frac_binary646.8
Simplified6.6
if -1.13550126787267889e153 < (*.f64 b1 b2) < -9.26325349230302468e-118 or -1.1211162412311246e-221 < (*.f64 b1 b2) < -1.5295473553899859e-272Initial program 4.6
rmApplied associate-/l*_binary643.6
Simplified11.0
rmApplied div-inv_binary6411.0
Applied *-un-lft-identity_binary6411.0
Applied times-frac_binary643.8
Applied *-un-lft-identity_binary643.8
Applied times-frac_binary643.6
Simplified3.5
Simplified3.5
if -9.26325349230302468e-118 < (*.f64 b1 b2) < -1.1211162412311246e-221 or 7.5262322703101004e-156 < (*.f64 b1 b2) < 2.1626414458035412e144Initial program 4.5
rmApplied associate-/l*_binary644.5
Simplified11.6
rmApplied div-inv_binary6411.8
Simplified4.6
Final simplification5.3
herbie shell --seed 2020268
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))