\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 = -inf.0:\\
\;\;\;\;\frac{\frac{1}{b1}}{\frac{\frac{b2}{a1}}{a2}}\\
\mathbf{elif}\;b1 \cdot b2 \le -4.8093039710866314 \cdot 10^{-235}:\\
\;\;\;\;\left(\frac{1}{b1 \cdot b2} \cdot a1\right) \cdot a2\\
\mathbf{elif}\;b1 \cdot b2 \le 3.1382336163668068 \cdot 10^{-212}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{elif}\;b1 \cdot b2 \le 8.6412368522216511 \cdot 10^{114}:\\
\;\;\;\;\left(\frac{1}{b1 \cdot b2} \cdot a1\right) \cdot a2\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b1 \cdot \frac{\frac{b2}{a1}}{a2}}\\
\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)) <= -inf.0)) {
VAR = ((1.0 / b1) / ((b2 / a1) / a2));
} else {
double VAR_1;
if ((((double) (b1 * b2)) <= -4.8093039710866314e-235)) {
VAR_1 = ((double) (((double) ((1.0 / ((double) (b1 * b2))) * a1)) * a2));
} else {
double VAR_2;
if ((((double) (b1 * b2)) <= 3.138233616366807e-212)) {
VAR_2 = ((((double) (a1 * a2)) / b1) / b2);
} else {
double VAR_3;
if ((((double) (b1 * b2)) <= 8.641236852221651e+114)) {
VAR_3 = ((double) (((double) ((1.0 / ((double) (b1 * b2))) * a1)) * a2));
} else {
VAR_3 = (1.0 / ((double) (b1 * ((b2 / a1) / a2))));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.2 |
|---|---|
| Target | 11.0 |
| Herbie | 6.6 |
if (* b1 b2) < -inf.0Initial program 23.4
rmApplied clear-num23.4
rmApplied associate-/r*23.1
rmApplied *-un-lft-identity23.1
Applied *-un-lft-identity23.1
Applied times-frac7.5
Applied times-frac3.3
Applied associate-/r*2.8
Simplified2.8
if -inf.0 < (* b1 b2) < -4.8093039710866314e-235 or 3.1382336163668068e-212 < (* b1 b2) < 8.6412368522216511e114Initial program 4.8
rmApplied clear-num5.1
rmApplied associate-/r*5.3
rmApplied div-inv5.3
rmApplied add-cube-cbrt5.3
Applied times-frac5.2
Simplified4.9
Simplified4.9
if -4.8093039710866314e-235 < (* b1 b2) < 3.1382336163668068e-212Initial program 34.7
rmApplied associate-/r*17.2
if 8.6412368522216511e114 < (* b1 b2) Initial program 13.2
rmApplied clear-num13.5
rmApplied associate-/r*13.1
rmApplied *-un-lft-identity13.1
Applied *-un-lft-identity13.1
Applied times-frac9.0
Applied times-frac7.6
Simplified7.6
Final simplification6.6
herbie shell --seed 2020182
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))