\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;a1 \cdot a2 \leq -4.803948692560538 \cdot 10^{+168}:\\
\;\;\;\;\frac{\sqrt[3]{a1} \cdot \sqrt[3]{a1}}{\frac{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}{\frac{1}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}}} \cdot \frac{\sqrt[3]{a1}}{\frac{\sqrt[3]{b1}}{\frac{a2}{\sqrt[3]{b2}}}}\\
\mathbf{elif}\;a1 \cdot a2 \leq -6.737766217048404 \cdot 10^{-162}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\mathbf{elif}\;a1 \cdot a2 \leq 6.83775354817476 \cdot 10^{-84}:\\
\;\;\;\;\frac{\sqrt[3]{a1}}{\frac{\sqrt[3]{b1}}{\frac{a2}{\sqrt[3]{b2}}}} \cdot \frac{\sqrt[3]{a1} \cdot \sqrt[3]{a1}}{\left(\sqrt[3]{b1} \cdot \sqrt[3]{b1}\right) \cdot \left(\sqrt[3]{b2} \cdot \sqrt[3]{b2}\right)}\\
\mathbf{elif}\;a1 \cdot a2 \leq 2.6529840764464326 \cdot 10^{+141}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{\frac{b1}{\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) -4.803948692560538e+168)
(*
(/
(* (cbrt a1) (cbrt a1))
(/ (* (cbrt b1) (cbrt b1)) (/ 1.0 (* (cbrt b2) (cbrt b2)))))
(/ (cbrt a1) (/ (cbrt b1) (/ a2 (cbrt b2)))))
(if (<= (* a1 a2) -6.737766217048404e-162)
(* (* a1 a2) (/ 1.0 (* b1 b2)))
(if (<= (* a1 a2) 6.83775354817476e-84)
(*
(/ (cbrt a1) (/ (cbrt b1) (/ a2 (cbrt b2))))
(/
(* (cbrt a1) (cbrt a1))
(* (* (cbrt b1) (cbrt b1)) (* (cbrt b2) (cbrt b2)))))
(if (<= (* a1 a2) 2.6529840764464326e+141)
(/ (/ (* 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) <= -4.803948692560538e+168) {
tmp = ((cbrt(a1) * cbrt(a1)) / ((cbrt(b1) * cbrt(b1)) / (1.0 / (cbrt(b2) * cbrt(b2))))) * (cbrt(a1) / (cbrt(b1) / (a2 / cbrt(b2))));
} else if ((a1 * a2) <= -6.737766217048404e-162) {
tmp = (a1 * a2) * (1.0 / (b1 * b2));
} else if ((a1 * a2) <= 6.83775354817476e-84) {
tmp = (cbrt(a1) / (cbrt(b1) / (a2 / cbrt(b2)))) * ((cbrt(a1) * cbrt(a1)) / ((cbrt(b1) * cbrt(b1)) * (cbrt(b2) * cbrt(b2))));
} else if ((a1 * a2) <= 2.6529840764464326e+141) {
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.4 |
|---|---|
| Target | 11.0 |
| Herbie | 4.4 |
if (*.f64 a1 a2) < -4.8039486925605376e168Initial program 30.5
rmApplied associate-/l*_binary64_343315.3
Simplified11.5
rmApplied add-cube-cbrt_binary64_352312.2
Applied *-un-lft-identity_binary64_348812.2
Applied times-frac_binary64_349412.2
Applied add-cube-cbrt_binary64_352312.4
Applied times-frac_binary64_34949.4
Applied add-cube-cbrt_binary64_35239.6
Applied times-frac_binary64_34946.6
if -4.8039486925605376e168 < (*.f64 a1 a2) < -6.7377662170484036e-162Initial program 4.0
rmApplied div-inv_binary64_34854.3
if -6.7377662170484036e-162 < (*.f64 a1 a2) < 6.8377535481747603e-84Initial program 12.3
rmApplied associate-/l*_binary64_34338.4
Simplified6.2
rmApplied add-cube-cbrt_binary64_35236.6
Applied *-un-lft-identity_binary64_34886.6
Applied times-frac_binary64_34946.7
Applied add-cube-cbrt_binary64_35236.8
Applied times-frac_binary64_34945.2
Applied add-cube-cbrt_binary64_35235.2
Applied times-frac_binary64_34943.1
Simplified3.1
if 6.8377535481747603e-84 < (*.f64 a1 a2) < 2.6529840764464326e141Initial program 3.2
rmApplied associate-/r*_binary64_34323.2
if 2.6529840764464326e141 < (*.f64 a1 a2) Initial program 27.2
rmApplied associate-/l*_binary64_343316.2
Simplified10.4
Final simplification4.4
herbie shell --seed 2021022
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))