\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{1}{b1} \cdot \left(\frac{a2}{b2} \cdot a1\right)\\
\mathbf{if}\;b1 \cdot b2 \leq -9.823918728322016 \cdot 10^{+138}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b1 \cdot b2 \leq -7.712653371308522 \cdot 10^{-200}:\\
\;\;\;\;\frac{{\left(\sqrt[3]{a1}\right)}^{2}}{b1 \cdot b2} \cdot \frac{\sqrt[3]{a1}}{\frac{1}{a2}}\\
\mathbf{elif}\;b1 \cdot b2 \leq 4.8465554479546714 \cdot 10^{-225}:\\
\;\;\;\;\frac{a2 \cdot \frac{a1}{b1}}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 5.461558340952208 \cdot 10^{+254}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\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 (* (/ 1.0 b1) (* (/ a2 b2) a1))))
(if (<= (* b1 b2) -9.823918728322016e+138)
t_0
(if (<= (* b1 b2) -7.712653371308522e-200)
(* (/ (pow (cbrt a1) 2.0) (* b1 b2)) (/ (cbrt a1) (/ 1.0 a2)))
(if (<= (* b1 b2) 4.8465554479546714e-225)
(/ (* a2 (/ a1 b1)) b2)
(if (<= (* b1 b2) 5.461558340952208e+254)
(/ a1 (/ (* b1 b2) a2))
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 = (1.0 / b1) * ((a2 / b2) * a1);
double tmp;
if ((b1 * b2) <= -9.823918728322016e+138) {
tmp = t_0;
} else if ((b1 * b2) <= -7.712653371308522e-200) {
tmp = (pow(cbrt(a1), 2.0) / (b1 * b2)) * (cbrt(a1) / (1.0 / a2));
} else if ((b1 * b2) <= 4.8465554479546714e-225) {
tmp = (a2 * (a1 / b1)) / b2;
} else if ((b1 * b2) <= 5.461558340952208e+254) {
tmp = a1 / ((b1 * b2) / a2);
} 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.6 |
| Herbie | 4.9 |
if (*.f64 b1 b2) < -9.8239187283220161e138 or 5.461558340952208e254 < (*.f64 b1 b2) Initial program 15.7
Applied associate-/l*_binary6415.0
Applied *-un-lft-identity_binary6415.0
Applied times-frac_binary647.7
Applied *-un-lft-identity_binary647.7
Applied times-frac_binary645.4
Simplified5.4
Simplified5.3
if -9.8239187283220161e138 < (*.f64 b1 b2) < -7.7126533713085219e-200Initial program 3.7
Applied associate-/l*_binary644.4
Applied div-inv_binary644.4
Applied add-cube-cbrt_binary645.2
Applied times-frac_binary642.0
Applied pow2_binary642.0
if -7.7126533713085219e-200 < (*.f64 b1 b2) < 4.84655544795467135e-225Initial program 33.3
Applied associate-/r*_binary6416.6
Simplified9.7
if 4.84655544795467135e-225 < (*.f64 b1 b2) < 5.461558340952208e254Initial program 5.4
Applied associate-/l*_binary645.0
Final simplification4.9
herbie shell --seed 2022055
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))