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




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.8 |
|---|---|
| Target | 11.3 |
| Herbie | 2.1 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied times-frac_binary6410.7
rmApplied associate-*l/_binary6419.5
rmApplied div-inv_binary6419.5
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.3109376793505e-312 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 8.9947643575975084e307Initial program 0.7
if -1.3109376793505e-312 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 12.9
rmApplied times-frac_binary642.2
if 8.9947643575975084e307 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 63.9
rmApplied times-frac_binary645.8
rmApplied add-cube-cbrt_binary646.8
Applied add-cube-cbrt_binary646.9
Applied times-frac_binary647.0
Applied associate-*l*_binary644.2
Simplified4.2
Final simplification2.1
herbie shell --seed 2020220
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))