\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \leq -2.7267614406301062 \cdot 10^{+231}:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b1}}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq -2.8110658549312455 \cdot 10^{-177}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 2.9965081420272 \cdot 10^{-320}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 2.5525240515500717 \cdot 10^{-125}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 1.8177159422765735 \cdot 10^{+208}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{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) -2.7267614406301062e+231)
(/ (* a1 (/ a2 b1)) b2)
(if (<= (* b1 b2) -2.8110658549312455e-177)
(* a2 (/ a1 (* b1 b2)))
(if (<= (* b1 b2) 2.9965081420272e-320)
(* (/ a1 b1) (/ a2 b2))
(if (<= (* b1 b2) 2.5525240515500717e-125)
(* a2 (/ a1 (* b1 b2)))
(if (<= (* b1 b2) 1.8177159422765735e+208)
(/ a1 (/ (* b1 b2) a2))
(* (/ 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 ((b1 * b2) <= -2.7267614406301062e+231) {
tmp = (a1 * (a2 / b1)) / b2;
} else if ((b1 * b2) <= -2.8110658549312455e-177) {
tmp = a2 * (a1 / (b1 * b2));
} else if ((b1 * b2) <= 2.9965081420272e-320) {
tmp = (a1 / b1) * (a2 / b2);
} else if ((b1 * b2) <= 2.5525240515500717e-125) {
tmp = a2 * (a1 / (b1 * b2));
} else if ((b1 * b2) <= 1.8177159422765735e+208) {
tmp = a1 / ((b1 * b2) / a2);
} 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.8 |
|---|---|
| Target | 11.1 |
| Herbie | 5.2 |
if (*.f64 b1 b2) < -2.72676144063010621e231Initial program 18.3
rmApplied associate-/r*_binary649.8
Simplified4.0
rmApplied *-un-lft-identity_binary644.0
Applied times-frac_binary647.3
Simplified7.3
Simplified17.8
rmApplied *-un-lft-identity_binary6417.8
Applied times-frac_binary647.6
Applied associate-*r*_binary643.8
Simplified3.7
rmApplied associate-*r/_binary644.3
Simplified4.3
if -2.72676144063010621e231 < (*.f64 b1 b2) < -2.8110658549312455e-177 or 2.99651e-320 < (*.f64 b1 b2) < 2.55252405155007167e-125Initial program 6.3
rmApplied associate-/r*_binary6412.5
Simplified14.4
rmApplied *-un-lft-identity_binary6414.4
Applied times-frac_binary6411.7
Simplified11.7
Simplified5.7
if -2.8110658549312455e-177 < (*.f64 b1 b2) < 2.99651e-320 or 1.81771594227657351e208 < (*.f64 b1 b2) Initial program 25.3
rmApplied times-frac_binary646.5
if 2.55252405155007167e-125 < (*.f64 b1 b2) < 1.81771594227657351e208Initial program 4.5
rmApplied associate-/l*_binary643.6
Final simplification5.2
herbie shell --seed 2021125
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))