\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \leq -1.0027776074466395 \cdot 10^{+199}:\\
\;\;\;\;\frac{a2 \cdot \frac{a1}{b1}}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq -4.3641756399046666 \cdot 10^{-273}:\\
\;\;\;\;\left(a2 \cdot a1\right) \cdot \frac{1}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 2.773549446951285 \cdot 10^{-114}:\\
\;\;\;\;\frac{\sqrt[3]{a1} \cdot \sqrt[3]{a1}}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}} \cdot \frac{\sqrt[3]{a1}}{\frac{\sqrt[3]{b1}}{\frac{a2}{b2}}}\\
\mathbf{elif}\;b1 \cdot b2 \leq 1.1283613478007406 \cdot 10^{+221}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a2 \cdot \frac{a1}{b1}}{b2}\\
\end{array}(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(if (<= (* b1 b2) -1.0027776074466395e+199)
(/ (* a2 (/ a1 b1)) b2)
(if (<= (* b1 b2) -4.3641756399046666e-273)
(* (* a2 a1) (/ 1.0 (* b1 b2)))
(if (<= (* b1 b2) 2.773549446951285e-114)
(*
(/ (* (cbrt a1) (cbrt a1)) (* (cbrt b1) (cbrt b1)))
(/ (cbrt a1) (/ (cbrt b1) (/ a2 b2))))
(if (<= (* b1 b2) 1.1283613478007406e+221)
(* a2 (/ a1 (* b1 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) <= -1.0027776074466395e+199) {
tmp = (a2 * (a1 / b1)) / b2;
} else if ((b1 * b2) <= -4.3641756399046666e-273) {
tmp = (a2 * a1) * (1.0 / (b1 * b2));
} else if ((b1 * b2) <= 2.773549446951285e-114) {
tmp = ((cbrt(a1) * cbrt(a1)) / (cbrt(b1) * cbrt(b1))) * (cbrt(a1) / (cbrt(b1) / (a2 / b2)));
} else if ((b1 * b2) <= 1.1283613478007406e+221) {
tmp = a2 * (a1 / (b1 * 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.5 |
|---|---|
| Target | 10.7 |
| Herbie | 5.0 |
if (*.f64 b1 b2) < -1.0027776074466395e199 or 1.1283613478007406e221 < (*.f64 b1 b2) Initial program 16.3
rmApplied associate-/r*_binary648.5
Simplified3.9
if -1.0027776074466395e199 < (*.f64 b1 b2) < -4.3641756399046666e-273Initial program 4.9
rmApplied div-inv_binary645.0
if -4.3641756399046666e-273 < (*.f64 b1 b2) < 2.77354944695128514e-114Initial program 30.1
rmApplied associate-/l*_binary6428.5
Simplified16.6
rmApplied *-un-lft-identity_binary6416.6
Applied *-un-lft-identity_binary6416.6
Applied times-frac_binary6416.6
Applied add-cube-cbrt_binary6417.3
Applied times-frac_binary6417.4
Applied add-cube-cbrt_binary6417.6
Applied times-frac_binary649.4
Simplified9.4
if 2.77354944695128514e-114 < (*.f64 b1 b2) < 1.1283613478007406e221Initial program 3.4
rmApplied associate-/l*_binary644.4
Simplified12.1
rmApplied div-inv_binary6412.1
Applied *-un-lft-identity_binary6412.1
Applied times-frac_binary644.5
Applied *-un-lft-identity_binary644.5
Applied times-frac_binary644.0
Simplified4.0
Simplified3.9
Final simplification5.0
herbie shell --seed 2020262
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))