\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \leq -7.598920629217912 \cdot 10^{+198}:\\
\;\;\;\;\frac{1}{\frac{b1}{a2}} \cdot \frac{a1}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq -9.536629910005653 \cdot 10^{-213}:\\
\;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 5.193948502327851 \cdot 10^{-106} \lor \neg \left(b1 \cdot b2 \leq 8.619819618703962 \cdot 10^{+164}\right):\\
\;\;\;\;\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{else}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\end{array}(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(if (<= (* b1 b2) -7.598920629217912e+198)
(* (/ 1.0 (/ b1 a2)) (/ a1 b2))
(if (<= (* b1 b2) -9.536629910005653e-213)
(* a1 (/ a2 (* b1 b2)))
(if (or (<= (* b1 b2) 5.193948502327851e-106)
(not (<= (* b1 b2) 8.619819618703962e+164)))
(*
(/
(* (cbrt a1) (cbrt a1))
(/ (* (cbrt b1) (cbrt b1)) (* (cbrt a2) (cbrt a2))))
(/ (cbrt a1) (/ (cbrt b1) (/ (cbrt a2) b2))))
(* a2 (/ a1 (* b1 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 ((b1 * b2) <= -7.598920629217912e+198) {
tmp = (1.0 / (b1 / a2)) * (a1 / b2);
} else if ((b1 * b2) <= -9.536629910005653e-213) {
tmp = a1 * (a2 / (b1 * b2));
} else if (((b1 * b2) <= 5.193948502327851e-106) || !((b1 * b2) <= 8.619819618703962e+164)) {
tmp = ((cbrt(a1) * cbrt(a1)) / ((cbrt(b1) * cbrt(b1)) / (cbrt(a2) * cbrt(a2)))) * (cbrt(a1) / (cbrt(b1) / (cbrt(a2) / b2)));
} else {
tmp = a2 * (a1 / (b1 * b2));
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.6 |
|---|---|
| Target | 11.0 |
| Herbie | 4.1 |
if (*.f64 b1 b2) < -7.5989206292179123e198Initial program 15.8
rmApplied associate-/l*_binary64_377416.2
Simplified8.5
rmApplied associate-/r/_binary64_37758.6
Applied *-un-lft-identity_binary64_38298.6
Applied times-frac_binary64_38354.7
if -7.5989206292179123e198 < (*.f64 b1 b2) < -9.53662991000565299e-213Initial program 5.1
rmApplied associate-/l*_binary64_37743.9
Simplified10.4
rmApplied div-inv_binary64_382610.7
Simplified4.0
if -9.53662991000565299e-213 < (*.f64 b1 b2) < 5.1939485023278511e-106 or 8.6198196187039622e164 < (*.f64 b1 b2) Initial program 19.8
rmApplied associate-/l*_binary64_377419.4
Simplified11.7
rmApplied *-un-lft-identity_binary64_382911.7
Applied add-cube-cbrt_binary64_386412.3
Applied times-frac_binary64_383512.3
Applied add-cube-cbrt_binary64_386412.4
Applied times-frac_binary64_383511.0
Applied add-cube-cbrt_binary64_386411.1
Applied times-frac_binary64_38354.3
if 5.1939485023278511e-106 < (*.f64 b1 b2) < 8.6198196187039622e164Initial program 3.8
rmApplied associate-/l*_binary64_37743.2
Simplified10.8
rmApplied div-inv_binary64_382610.9
Applied *-un-lft-identity_binary64_382910.9
Applied times-frac_binary64_38353.3
Applied *-un-lft-identity_binary64_38293.3
Applied times-frac_binary64_38353.6
Simplified3.5
Simplified3.5
Final simplification4.1
herbie shell --seed 2021026
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))