\frac{a1 \cdot a2}{b1 \cdot b2}\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -1.8491308375381354 \cdot 10^{-297}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 0:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq 1.0919793165783516 \cdot 10^{+303}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\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 (<= (/ (* a1 a2) (* b1 b2)) (- INFINITY))
(* a1 (/ (/ a2 b1) b2))
(if (<= (/ (* a1 a2) (* b1 b2)) -1.8491308375381354e-297)
(/ (* a1 a2) (* b1 b2))
(if (<= (/ (* a1 a2) (* b1 b2)) 0.0)
(* a1 (/ (/ a2 b1) b2))
(if (<= (/ (* a1 a2) (* b1 b2)) 1.0919793165783516e+303)
(/ (* 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 = a1 * ((a2 / b1) / b2);
} else if (((a1 * a2) / (b1 * b2)) <= -1.8491308375381354e-297) {
tmp = (a1 * a2) / (b1 * b2);
} else if (((a1 * a2) / (b1 * b2)) <= 0.0) {
tmp = a1 * ((a2 / b1) / b2);
} else if (((a1 * a2) / (b1 * b2)) <= 1.0919793165783516e+303) {
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.3 |
|---|---|
| Target | 11.3 |
| Herbie | 2.7 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or -1.8491308375381354e-297 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 18.3
rmApplied div-inv_binary64_314418.3
rmApplied associate-*l*_binary64_30889.5
Simplified9.4
rmApplied associate-/r*_binary64_30915.3
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.8491308375381354e-297 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 1.09197931657835163e303Initial program 0.7
if 1.09197931657835163e303 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 62.9
rmApplied times-frac_binary64_31536.5
Final simplification2.7
herbie shell --seed 2021050
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))