\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\
\;\;\;\;\frac{1}{\frac{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}} \cdot \frac{a1}{\frac{\sqrt[3]{b1}}{\frac{\sqrt[3]{a2}}{b2}}}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -7.236966565131328 \cdot 10^{-276} \lor \neg \left(\frac{a1 \cdot a2}{b1 \cdot b2} \leq 0\right) \land \frac{a1 \cdot a2}{b1 \cdot b2} \leq 4.237073333052789 \cdot 10^{+273}:\\
\;\;\;\;\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))
(*
(/ 1.0 (/ (* (cbrt b1) (cbrt b1)) (* (cbrt a2) (cbrt a2))))
(/ a1 (/ (cbrt b1) (/ (cbrt a2) b2))))
(if (or (<= (/ (* a1 a2) (* b1 b2)) -7.236966565131328e-276)
(and (not (<= (/ (* a1 a2) (* b1 b2)) 0.0))
(<= (/ (* a1 a2) (* b1 b2)) 4.237073333052789e+273)))
(/ (* 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 = (1.0 / ((cbrt(b1) * cbrt(b1)) / (cbrt(a2) * cbrt(a2)))) * (a1 / (cbrt(b1) / (cbrt(a2) / b2)));
} else if ((((a1 * a2) / (b1 * b2)) <= -7.236966565131328e-276) || (!(((a1 * a2) / (b1 * b2)) <= 0.0) && (((a1 * a2) / (b1 * b2)) <= 4.237073333052789e+273))) {
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.0 |
|---|---|
| Target | 11.7 |
| Herbie | 2.4 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied associate-/l*_binary6427.9
Simplified17.6
rmApplied *-un-lft-identity_binary6417.6
Applied add-cube-cbrt_binary6418.4
Applied times-frac_binary6418.4
Applied add-cube-cbrt_binary6418.6
Applied times-frac_binary6414.3
Applied *-un-lft-identity_binary6414.3
Applied times-frac_binary649.0
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -7.2369665651313282e-276 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 4.2370733330527888e273Initial program 0.7
if -7.2369665651313282e-276 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0 or 4.2370733330527888e273 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 21.5
rmApplied associate-/l*_binary6415.3
Simplified6.8
rmApplied associate-/r/_binary646.7
Applied *-un-lft-identity_binary646.7
Applied times-frac_binary644.3
Simplified4.2
Final simplification2.4
herbie shell --seed 2021148
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))