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




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 10.8 |
|---|---|
| Target | 11.4 |
| Herbie | 2.9 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 9.9
rmApplied associate-/l*_binary649.0
Simplified9.7
rmApplied add-cube-cbrt_binary6410.1
Applied add-cube-cbrt_binary6410.3
Applied times-frac_binary6410.3
Applied *-un-lft-identity_binary6410.3
Applied times-frac_binary647.4
Applied add-cube-cbrt_binary647.5
Applied times-frac_binary643.4
if 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 3.52613780742779975e292Initial program 0.7
if 3.52613780742779975e292 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 60.5
rmApplied associate-/l*_binary6444.8
Simplified13.5
rmApplied *-un-lft-identity_binary6413.5
Applied add-cube-cbrt_binary6414.3
Applied times-frac_binary6414.3
Applied add-cube-cbrt_binary6414.5
Applied times-frac_binary6412.8
Applied *-un-lft-identity_binary6412.8
Applied times-frac_binary646.9
Simplified6.9
Final simplification2.9
herbie shell --seed 2021126
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))