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




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 12.0 |
|---|---|
| Target | 11.6 |
| Herbie | 3.2 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
Applied associate-/r*_binary6433.2
Applied associate-/l*_binary6415.2
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.6989813180162923e-283Initial program 0.7
Applied associate-/r*_binary648.5
Applied div-inv_binary648.6
Applied frac-times_binary640.7
if -1.6989813180162923e-283 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0 or 1.33494608661071378e220 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 21.7
Applied times-frac_binary645.1
if -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 1.33494608661071378e220Initial program 1.0
Applied associate-/r*_binary647.8
Applied div-inv_binary647.9
Applied associate-/l*_binary641.0
Final simplification3.2
herbie shell --seed 2021357
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))