\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -1.1144896539576276 \cdot 10^{-302}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{a2 \cdot \frac{a1}{b2}}{b1}\\
\mathbf{elif}\;t_0 \leq 5.658058179724235 \cdot 10^{+290}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\
\end{array}
(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(let* ((t_0 (/ (* a1 a2) (* b1 b2))))
(if (<= t_0 -1.1144896539576276e-302)
t_0
(if (<= t_0 0.0)
(/ (* a2 (/ a1 b2)) b1)
(if (<= t_0 5.658058179724235e+290) t_0 (* (/ a1 b2) (/ a2 b1)))))))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 t_0 = (a1 * a2) / (b1 * b2);
double tmp;
if (t_0 <= -1.1144896539576276e-302) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a2 * (a1 / b2)) / b1;
} else if (t_0 <= 5.658058179724235e+290) {
tmp = t_0;
} else {
tmp = (a1 / b2) * (a2 / b1);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.3 |
|---|---|
| Target | 11.6 |
| Herbie | 4.1 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.114489653957628e-302 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 5.65805817972423479e290Initial program 4.1
if -1.114489653957628e-302 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.7
rmApplied div-inv_binary6413.7
Simplified13.7
rmApplied un-div-inv_binary6413.7
Applied associate-/r*_binary646.6
Simplified3.3
if 5.65805817972423479e290 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 59.2
rmApplied div-inv_binary6459.3
Simplified59.3
rmApplied un-div-inv_binary6459.2
Applied times-frac_binary647.6
Final simplification4.1
herbie shell --seed 2021211
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))