\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -5.823042481815751 \cdot 10^{-280}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 0:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 4.5556577587153316 \cdot 10^{+226}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\
\end{array}(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(if (<= (/ (* a1 a2) (* b1 b2)) (- INFINITY))
(* (/ a2 b1) (/ a1 b2))
(if (<= (/ (* a1 a2) (* b1 b2)) -5.823042481815751e-280)
(/ (* a1 a2) (* b1 b2))
(if (<= (/ (* a1 a2) (* b1 b2)) 0.0)
(* (/ a1 b1) (/ a2 b2))
(if (<= (/ (* a1 a2) (* b1 b2)) 4.5556577587153316e+226)
(/ (* a1 a2) (* b1 b2))
(/ 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 (((a1 * a2) / (b1 * b2)) <= -((double) INFINITY)) {
tmp = (a2 / b1) * (a1 / b2);
} else if (((a1 * a2) / (b1 * b2)) <= -5.823042481815751e-280) {
tmp = (a1 * a2) / (b1 * b2);
} else if (((a1 * a2) / (b1 * b2)) <= 0.0) {
tmp = (a1 / b1) * (a2 / b2);
} else if (((a1 * a2) / (b1 * b2)) <= 4.5556577587153316e+226) {
tmp = (a1 * a2) / (b1 * b2);
} 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.5 |
|---|---|
| Target | 10.8 |
| Herbie | 3.3 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
rmApplied associate-/l*_binary64_343329.9
Simplified16.0
rmApplied associate-/r/_binary64_343415.8
Applied *-un-lft-identity_binary64_348815.8
Applied times-frac_binary64_349413.2
Simplified13.2
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -5.82304248181575058e-280 or -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 4.55565775871533158e226Initial program 0.9
if -5.82304248181575058e-280 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 12.8
rmApplied times-frac_binary64_34943.0
if 4.55565775871533158e226 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 46.8
rmApplied associate-/l*_binary64_343337.8
Simplified14.6
Final simplification3.3
herbie shell --seed 2021027
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))