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




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.5 |
|---|---|
| Target | 11.7 |
| Herbie | 5.0 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -2.8142638068678418e-179 or 3.47943626172792874e303 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 20.0
rmApplied clear-num_binary6420.1
rmApplied associate-/l*_binary6418.2
Simplified14.2
rmApplied add-cube-cbrt_binary6415.0
Applied *-un-lft-identity_binary6415.0
Applied times-frac_binary6415.0
Applied add-cube-cbrt_binary6415.2
Applied times-frac_binary6412.2
Applied add-cube-cbrt_binary6412.4
Applied times-frac_binary647.5
Simplified7.5
if -2.8142638068678418e-179 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 11.7
rmApplied clear-num_binary6412.0
rmApplied times-frac_binary646.3
Applied associate-/r*_binary645.8
Simplified5.5
if -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 3.47943626172792874e303Initial program 0.9
rmApplied clear-num_binary641.4
Final simplification5.0
herbie shell --seed 2020233
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))