\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
t_1 := \frac{1}{\frac{b1}{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}} \cdot \frac{a1}{\frac{b2}{\sqrt[3]{a2}}}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -5.228923257196031 \cdot 10^{-300}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{a1}{b1 \cdot \frac{b2}{a2}}\\
\mathbf{elif}\;t_0 \leq 1.4421320560907244 \cdot 10^{+306}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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)))
(t_1
(* (/ 1.0 (/ b1 (* (cbrt a2) (cbrt a2)))) (/ a1 (/ b2 (cbrt a2))))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -5.228923257196031e-300)
t_0
(if (<= t_0 0.0)
(/ a1 (* b1 (/ b2 a2)))
(if (<= t_0 1.4421320560907244e+306) t_0 t_1))))))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 t_1 = (1.0 / (b1 / (cbrt(a2) * cbrt(a2)))) * (a1 / (b2 / cbrt(a2)));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -5.228923257196031e-300) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = a1 / (b1 * (b2 / a2));
} else if (t_0 <= 1.4421320560907244e+306) {
tmp = t_0;
} else {
tmp = t_1;
}
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 | 2.5 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or 1.4421320560907244e306 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 63.5
Applied associate-/l*_binary6441.3
Applied add-cube-cbrt_binary6441.6
Applied times-frac_binary6413.4
Applied *-un-lft-identity_binary6413.4
Applied times-frac_binary647.7
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -5.22892325719603109e-300 or -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 1.4421320560907244e306Initial program 0.8
Applied associate-/l*_binary647.5
Applied div-inv_binary647.6
Applied *-un-lft-identity_binary647.6
Applied times-frac_binary641.3
Applied *-un-lft-identity_binary641.3
Applied associate-*l*_binary641.3
Simplified0.8
if -5.22892325719603109e-300 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 13.6
Applied associate-/l*_binary647.5
Applied *-un-lft-identity_binary647.5
Applied times-frac_binary643.8
Simplified3.8
Final simplification2.5
herbie shell --seed 2021329
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))