\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\
\;\;\;\;\frac{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}{\left(\sqrt[3]{b2} \cdot \sqrt[3]{b2}\right) \cdot \left(\sqrt[3]{b1} \cdot \sqrt[3]{b1}\right)} \cdot \frac{\sqrt[3]{a2}}{\frac{\sqrt[3]{b2}}{\frac{a1}{\sqrt[3]{b1}}}}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -3.19219955785124 \cdot 10^{-227} \lor \neg \left(\frac{a1 \cdot a2}{b1 \cdot b2} \leq 0\right) \land \frac{a1 \cdot a2}{b1 \cdot b2} \leq 8.655475196185196 \cdot 10^{+273}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\
\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))
(*
(/
(* (cbrt a2) (cbrt a2))
(* (* (cbrt b2) (cbrt b2)) (* (cbrt b1) (cbrt b1))))
(/ (cbrt a2) (/ (cbrt b2) (/ a1 (cbrt b1)))))
(if (or (<= (/ (* a1 a2) (* b1 b2)) -3.19219955785124e-227)
(and (not (<= (/ (* a1 a2) (* b1 b2)) 0.0))
(<= (/ (* a1 a2) (* b1 b2)) 8.655475196185196e+273)))
(/ (* a1 a2) (* b1 b2))
(* (/ a1 b2) (/ a2 b1)))))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 = ((cbrt(a2) * cbrt(a2)) / ((cbrt(b2) * cbrt(b2)) * (cbrt(b1) * cbrt(b1)))) * (cbrt(a2) / (cbrt(b2) / (a1 / cbrt(b1))));
} else if ((((a1 * a2) / (b1 * b2)) <= -3.19219955785124e-227) || (!(((a1 * a2) / (b1 * b2)) <= 0.0) && (((a1 * a2) / (b1 * b2)) <= 8.655475196185196e+273))) {
tmp = (a1 * a2) / (b1 * b2);
} else {
tmp = (a1 / b2) * (a2 / b1);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.6 |
|---|---|
| Target | 11.3 |
| Herbie | 2.8 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied associate-/r*_binary64_275033.0
Simplified19.6
rmApplied associate-/l*_binary64_275116.8
rmApplied add-cube-cbrt_binary64_284117.5
Applied *-un-lft-identity_binary64_280617.5
Applied times-frac_binary64_281217.5
Applied add-cube-cbrt_binary64_284117.8
Applied times-frac_binary64_281217.7
Applied add-cube-cbrt_binary64_284117.8
Applied times-frac_binary64_28129.8
Simplified9.8
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -3.1921995578512398e-227 or -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 8.6554751961851957e273Initial program 0.8
if -3.1921995578512398e-227 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0 or 8.6554751961851957e273 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 20.5
rmApplied associate-/r*_binary64_275014.7
Simplified6.9
rmApplied associate-/l*_binary64_27517.0
rmApplied associate-/r/_binary64_27526.7
Applied *-un-lft-identity_binary64_28066.7
Applied times-frac_binary64_28124.7
Simplified4.5
Final simplification2.8
herbie shell --seed 2020342
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))