\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\
\;\;\;\;\left(\left(\sqrt[3]{a1} \cdot \sqrt[3]{a1}\right) \cdot \frac{\sqrt{a2}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}\right) \cdot \frac{\sqrt[3]{a1}}{\frac{b1}{\frac{\sqrt{a2}}{\sqrt[3]{b2}}}}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -6.071878077981701 \cdot 10^{-258}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 6.0852529623557 \cdot 10^{-300}:\\
\;\;\;\;\frac{a2 \cdot \frac{a1}{b1}}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 2.0209193229969348 \cdot 10^{+301}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{a1} \cdot \sqrt[3]{a1}}{b1} \cdot \left(\sqrt[3]{a1} \cdot \frac{a2}{b2}\right)\\
\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 a1) (cbrt a1)) (/ (sqrt a2) (* (cbrt b2) (cbrt b2))))
(/ (cbrt a1) (/ b1 (/ (sqrt a2) (cbrt b2)))))
(if (<= (/ (* a1 a2) (* b1 b2)) -6.071878077981701e-258)
(/ (* a1 a2) (* b1 b2))
(if (<= (/ (* a1 a2) (* b1 b2)) 6.0852529623557e-300)
(/ (* a2 (/ a1 b1)) b2)
(if (<= (/ (* a1 a2) (* b1 b2)) 2.0209193229969348e+301)
(/ (* a1 a2) (* b1 b2))
(* (/ (* (cbrt a1) (cbrt a1)) b1) (* (cbrt a1) (/ 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 = ((cbrt(a1) * cbrt(a1)) * (sqrt(a2) / (cbrt(b2) * cbrt(b2)))) * (cbrt(a1) / (b1 / (sqrt(a2) / cbrt(b2))));
} else if (((a1 * a2) / (b1 * b2)) <= -6.071878077981701e-258) {
tmp = (a1 * a2) / (b1 * b2);
} else if (((a1 * a2) / (b1 * b2)) <= 6.0852529623557e-300) {
tmp = (a2 * (a1 / b1)) / b2;
} else if (((a1 * a2) / (b1 * b2)) <= 2.0209193229969348e+301) {
tmp = (a1 * a2) / (b1 * b2);
} else {
tmp = ((cbrt(a1) * cbrt(a1)) / b1) * (cbrt(a1) * (a2 / b2));
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 10.7 |
|---|---|
| Target | 11.5 |
| Herbie | 3.1 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied associate-/l*_binary64_377430.5
Simplified14.7
rmApplied add-cube-cbrt_binary64_386415.5
Applied add-sqr-sqrt_binary64_385130.3
Applied times-frac_binary64_383530.3
Applied *-un-lft-identity_binary64_382930.3
Applied times-frac_binary64_383527.0
Applied add-cube-cbrt_binary64_386427.2
Applied times-frac_binary64_383520.9
Simplified20.9
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -6.07187807798170119e-258 or 6.0852529623556994e-300 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 2.02091932299693483e301Initial program 0.8
if -6.07187807798170119e-258 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 6.0852529623556994e-300Initial program 12.3
rmApplied associate-/r*_binary64_37736.9
Simplified4.6
if 2.02091932299693483e301 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 62.7
rmApplied associate-/l*_binary64_377447.3
Simplified12.5
rmApplied div-inv_binary64_382612.5
Applied add-cube-cbrt_binary64_386413.2
Applied times-frac_binary64_38356.5
Simplified6.5
Final simplification3.1
herbie shell --seed 2021098
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))