\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \leq -4.193834960798578 \cdot 10^{+261}:\\
\;\;\;\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{a2} \cdot \sqrt[3]{a2}\right)\right) \cdot \frac{\sqrt[3]{a2}}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq -3.9728237755663456 \cdot 10^{-292}:\\
\;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 1.4607986041132002 \cdot 10^{-243}:\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 6.036554690463631 \cdot 10^{+287}:\\
\;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{a2} \cdot \sqrt[3]{a2}\right)\right) \cdot \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 (<= (* b1 b2) -4.193834960798578e+261)
(* (* (/ a1 b1) (* (cbrt a2) (cbrt a2))) (/ (cbrt a2) b2))
(if (<= (* b1 b2) -3.9728237755663456e-292)
(* a1 (/ a2 (* b1 b2)))
(if (<= (* b1 b2) 1.4607986041132002e-243)
(/ (* (/ a1 b1) a2) b2)
(if (<= (* b1 b2) 6.036554690463631e+287)
(* a1 (/ a2 (* b1 b2)))
(* (* (/ a1 b1) (* (cbrt a2) (cbrt a2))) (/ (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 ((b1 * b2) <= -4.193834960798578e+261) {
tmp = ((a1 / b1) * (cbrt(a2) * cbrt(a2))) * (cbrt(a2) / b2);
} else if ((b1 * b2) <= -3.9728237755663456e-292) {
tmp = a1 * (a2 / (b1 * b2));
} else if ((b1 * b2) <= 1.4607986041132002e-243) {
tmp = ((a1 / b1) * a2) / b2;
} else if ((b1 * b2) <= 6.036554690463631e+287) {
tmp = a1 * (a2 / (b1 * b2));
} else {
tmp = ((a1 / b1) * (cbrt(a2) * cbrt(a2))) * (cbrt(a2) / b2);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.5 |
|---|---|
| Target | 11.9 |
| Herbie | 5.3 |
if (*.f64 b1 b2) < -4.19383496079857828e261 or 6.03655469046363111e287 < (*.f64 b1 b2) Initial program 20.4
rmApplied times-frac_binary643.1
rmApplied *-un-lft-identity_binary643.1
Applied add-cube-cbrt_binary643.4
Applied times-frac_binary643.4
Applied associate-*r*_binary642.8
Simplified2.8
if -4.19383496079857828e261 < (*.f64 b1 b2) < -3.97282377556634561e-292 or 1.4607986041132002e-243 < (*.f64 b1 b2) < 6.03655469046363111e287Initial program 5.3
rmApplied times-frac_binary6414.5
rmApplied div-inv_binary6414.6
Applied associate-*l*_binary6412.0
Simplified5.8
if -3.97282377556634561e-292 < (*.f64 b1 b2) < 1.4607986041132002e-243Initial program 46.2
rmApplied associate-/r*_binary6417.5
Simplified7.5
Final simplification5.3
herbie shell --seed 2020224
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))