\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:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;t_0 \leq -1.1429146543765217 \cdot 10^{-267}:\\
\;\;\;\;\frac{a1 \cdot a2}{\frac{b1}{\frac{1}{b2}}}\\
\mathbf{elif}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 8.720832817076526 \cdot 10^{+201}\right):\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\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 b1) (/ a2 b2))
(if (<= t_0 -1.1429146543765217e-267)
(/ (* a1 a2) (/ b1 (/ 1.0 b2)))
(if (or (<= t_0 0.0) (not (<= t_0 8.720832817076526e+201)))
(* (/ a2 b1) (/ a1 b2))
t_0)))))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 / b1) * (a2 / b2);
} else if (t_0 <= -1.1429146543765217e-267) {
tmp = (a1 * a2) / (b1 / (1.0 / b2));
} else if ((t_0 <= 0.0) || !(t_0 <= 8.720832817076526e+201)) {
tmp = (a2 / b1) * (a1 / b2);
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.2 |
|---|---|
| Target | 11.4 |
| Herbie | 3.2 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied times-frac_binary6412.8
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.1429146543765217e-267Initial program 0.8
rmApplied associate-/l*_binary648.1
Simplified14.2
rmApplied div-inv_binary6414.3
Applied *-un-lft-identity_binary6414.3
Applied times-frac_binary648.3
Applied associate-/r*_binary640.9
Simplified0.9
if -1.1429146543765217e-267 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0 or 8.72083281707652592e201 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 19.6
rmApplied associate-/l*_binary6414.3
Simplified7.3
rmApplied associate-/r/_binary647.3
Applied *-un-lft-identity_binary647.3
Applied times-frac_binary645.5
Simplified5.4
if -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 8.72083281707652592e201Initial program 0.7
Final simplification3.2
herbie shell --seed 2021196
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))