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




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.5 |
|---|---|
| Target | 11.1 |
| Herbie | 2.3 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied associate-/l*_binary64_206931.7
Simplified14.3
rmApplied associate-/r/_binary64_207014.6
Applied *-un-lft-identity_binary64_212414.6
Applied times-frac_binary64_213011.0
Simplified10.9
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -7.7574596095774818e-308 or -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 3.6768549028725003e272Initial program 0.9
if -7.7574596095774818e-308 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 13.4
rmApplied associate-/l*_binary64_20697.2
Simplified3.9
rmApplied *-un-lft-identity_binary64_21243.9
Applied add-cube-cbrt_binary64_21594.1
Applied times-frac_binary64_21304.1
Applied add-cube-cbrt_binary64_21594.1
Applied times-frac_binary64_21303.7
Applied add-cube-cbrt_binary64_21593.7
Applied times-frac_binary64_21302.0
Simplified2.0
if 3.6768549028725003e272 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 54.6
rmApplied times-frac_binary64_21309.5
Final simplification2.3
herbie shell --seed 2020308
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))