\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;a1 \cdot \frac{1}{\frac{b2}{\frac{a2}{b1}}}\\
\mathbf{elif}\;t_0 \leq -6.165001 \cdot 10^{-317} \lor \neg \left(t_0 \leq 0\right) \land t_0 \leq 8.745338238018392 \cdot 10^{+303}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\end{array}
(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(let* ((t_0 (/ (* a1 a2) (* b1 b2))))
(if (<= t_0 (- INFINITY))
(* a1 (/ 1.0 (/ b2 (/ a2 b1))))
(if (or (<= t_0 -6.165001e-317)
(and (not (<= t_0 0.0)) (<= t_0 8.745338238018392e+303)))
t_0
(* (/ a1 b1) (/ a2 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 t_0 = (a1 * a2) / (b1 * b2);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = a1 * (1.0 / (b2 / (a2 / b1)));
} else if ((t_0 <= -6.165001e-317) || (!(t_0 <= 0.0) && (t_0 <= 8.745338238018392e+303))) {
tmp = t_0;
} else {
tmp = (a1 / b1) * (a2 / b2);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.0 |
|---|---|
| Target | 11.6 |
| Herbie | 2.0 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied div-inv_binary6464.0
Simplified64.0
rmApplied associate-*l*_binary6429.8
Simplified29.7
rmApplied clear-num_binary6429.8
Simplified15.9
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -6.16500103e-317 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 8.7453382380183924e303Initial program 0.7
if -6.16500103e-317 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0 or 8.7453382380183924e303 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 22.3
rmApplied times-frac_binary642.8
Final simplification2.0
herbie shell --seed 2021206
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))