\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -1.12917095165229 \cdot 10^{-304}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 0:\\
\;\;\;\;\frac{\frac{a2}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}} \cdot \frac{a1}{\sqrt[3]{b1}}}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 4.4409601181936536 \cdot 10^{+266}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\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 b1) (/ a2 b2))
(if (<= (/ (* a1 a2) (* b1 b2)) -1.12917095165229e-304)
(/ (* a1 a2) (* b1 b2))
(if (<= (/ (* a1 a2) (* b1 b2)) 0.0)
(/ (* (/ a2 (* (cbrt b1) (cbrt b1))) (/ a1 (cbrt b1))) b2)
(if (<= (/ (* a1 a2) (* b1 b2)) 4.4409601181936536e+266)
(/ (* a1 a2) (* b1 b2))
(* (/ a2 b1) (/ a1 b2)))))))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 / b1) * (a2 / b2);
} else if (((a1 * a2) / (b1 * b2)) <= -1.12917095165229e-304) {
tmp = (a1 * a2) / (b1 * b2);
} else if (((a1 * a2) / (b1 * b2)) <= 0.0) {
tmp = ((a2 / (cbrt(b1) * cbrt(b1))) * (a1 / cbrt(b1))) / b2;
} else if (((a1 * a2) / (b1 * b2)) <= 4.4409601181936536e+266) {
tmp = (a1 * a2) / (b1 * b2);
} else {
tmp = (a2 / b1) * (a1 / b2);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.3 |
|---|---|
| Target | 11.2 |
| Herbie | 2.4 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied times-frac_binary64_55409.9
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.12917095165229e-304 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 4.4409601181936536e266Initial program 0.8
if -1.12917095165229e-304 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.7
rmApplied associate-/r*_binary64_54786.5
Simplified3.4
rmApplied add-cube-cbrt_binary64_55693.6
Applied *-un-lft-identity_binary64_55343.6
Applied times-frac_binary64_55403.6
Applied associate-*r*_binary64_54743.1
Simplified3.1
if 4.4409601181936536e266 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 54.8
rmApplied associate-/l*_binary64_547942.6
Simplified15.1
rmApplied associate-/r/_binary64_548014.5
Applied *-un-lft-identity_binary64_553414.5
Applied times-frac_binary64_55408.9
Simplified8.8
Final simplification2.4
herbie shell --seed 2020355
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))