\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \le -2.95890435295476721 \cdot 10^{211}:\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \le -9.2498994217787959 \cdot 10^{-213} \lor \neg \left(b1 \cdot b2 \le -0.0\right) \land b1 \cdot b2 \le 1.023298139213398 \cdot 10^{209}:\\
\;\;\;\;\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\end{array}double code(double a1, double a2, double b1, double b2) {
return (((double) (a1 * a2)) / ((double) (b1 * b2)));
}
double code(double a1, double a2, double b1, double b2) {
double VAR;
if ((((double) (b1 * b2)) <= -2.958904352954767e+211)) {
VAR = ((double) ((a2 / b1) * (a1 / b2)));
} else {
double VAR_1;
if (((((double) (b1 * b2)) <= -9.249899421778796e-213) || (!(((double) (b1 * b2)) <= -0.0) && (((double) (b1 * b2)) <= 1.023298139213398e+209)))) {
VAR_1 = ((a1 / ((double) (b1 * b2))) / (1.0 / a2));
} else {
VAR_1 = ((double) ((a2 / b1) * (a1 / b2)));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.6 |
|---|---|
| Target | 11.4 |
| Herbie | 5.4 |
if (* b1 b2) < -2.95890435295476721e211 or -9.2498994217787959e-213 < (* b1 b2) < -0.0 or 1.023298139213398e209 < (* b1 b2) Initial program 23.1
rmApplied associate-/l*23.0
rmApplied add-cube-cbrt23.2
Applied times-frac10.9
Applied add-cube-cbrt11.0
Applied times-frac4.1
rmApplied pow14.1
Applied pow14.1
Applied pow-prod-down4.1
Simplified11.4
rmApplied associate-/r/11.3
Applied *-un-lft-identity11.3
Applied times-frac5.5
Simplified5.4
if -2.95890435295476721e211 < (* b1 b2) < -9.2498994217787959e-213 or -0.0 < (* b1 b2) < 1.023298139213398e209Initial program 5.3
rmApplied associate-/l*5.1
rmApplied div-inv5.1
Applied associate-/r*5.5
Final simplification5.4
herbie shell --seed 2020181
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))