\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\
\;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -2.670346478966627 \cdot 10^{-291}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 0:\\
\;\;\;\;\frac{1}{\left(b2 \cdot \frac{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}{a1}\right) \cdot \frac{\sqrt[3]{b1}}{a2}}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 2.4779041765760598 \cdot 10^{+294}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\
\end{array}(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(if (<= (/ (* a1 a2) (* b1 b2)) (- INFINITY))
(/ (/ a1 b2) (/ b1 a2))
(if (<= (/ (* a1 a2) (* b1 b2)) -2.670346478966627e-291)
(/ (* a1 a2) (* b1 b2))
(if (<= (/ (* a1 a2) (* b1 b2)) 0.0)
(/ 1.0 (* (* b2 (/ (* (cbrt b1) (cbrt b1)) a1)) (/ (cbrt b1) a2)))
(if (<= (/ (* a1 a2) (* b1 b2)) 2.4779041765760598e+294)
(/ (* a1 a2) (* b1 b2))
(/ (/ a1 b2) (/ b1 a2)))))))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 tmp;
if (((a1 * a2) / (b1 * b2)) <= -((double) INFINITY)) {
tmp = (a1 / b2) / (b1 / a2);
} else if (((a1 * a2) / (b1 * b2)) <= -2.670346478966627e-291) {
tmp = (a1 * a2) / (b1 * b2);
} else if (((a1 * a2) / (b1 * b2)) <= 0.0) {
tmp = 1.0 / ((b2 * ((cbrt(b1) * cbrt(b1)) / a1)) * (cbrt(b1) / a2));
} else if (((a1 * a2) / (b1 * b2)) <= 2.4779041765760598e+294) {
tmp = (a1 * a2) / (b1 * b2);
} else {
tmp = (a1 / b2) / (b1 / a2);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.3 |
|---|---|
| Target | 11.7 |
| Herbie | 2.7 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or 2.47790417657605985e294 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 61.3
rmApplied clear-num_binary64_587461.3
rmApplied associate-/l*_binary64_582044.2
Simplified15.1
rmApplied associate-/r/_binary64_582114.8
Applied *-un-lft-identity_binary64_587514.8
Applied times-frac_binary64_58817.7
Applied associate-/r*_binary64_58197.6
Simplified7.5
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -2.67034647896662683e-291 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 2.47790417657605985e294Initial program 0.9
if -2.67034647896662683e-291 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.6
rmApplied clear-num_binary64_587414.0
rmApplied associate-/l*_binary64_58207.2
Simplified4.7
rmApplied associate-/r/_binary64_58214.6
Applied add-cube-cbrt_binary64_59104.8
Applied times-frac_binary64_58814.4
Simplified4.4
Final simplification2.7
herbie shell --seed 2021024
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))