\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -9.070334479927686 \cdot 10^{+287}:\\
\;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\
\mathbf{elif}\;t_0 \leq -2.9350118109617432 \cdot 10^{-282}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\
\mathbf{elif}\;t_0 \leq 8.508576472122102 \cdot 10^{+294}:\\
\;\;\;\;t_0\\
\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
(let* ((t_0 (/ (* a1 a2) (* b1 b2))))
(if (<= t_0 -9.070334479927686e+287)
(/ (/ a1 b2) (/ b1 a2))
(if (<= t_0 -2.9350118109617432e-282)
t_0
(if (<= t_0 0.0)
(* (/ a1 b2) (/ a2 b1))
(if (<= t_0 8.508576472122102e+294) t_0 (* (/ 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 t_0 = (a1 * a2) / (b1 * b2);
double tmp;
if (t_0 <= -9.070334479927686e+287) {
tmp = (a1 / b2) / (b1 / a2);
} else if (t_0 <= -2.9350118109617432e-282) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a1 / b2) * (a2 / b1);
} else if (t_0 <= 8.508576472122102e+294) {
tmp = t_0;
} 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.4 |
| Herbie | 2.4 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -9.07033447992768629e287Initial program 54.0
Applied egg-rr16.2
Applied egg-rr14.7
if -9.07033447992768629e287 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -2.93501181096174324e-282 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 8.5085764721221019e294Initial program 0.7
Applied egg-rr7.6
Taylor expanded in a1 around 0 0.7
if -2.93501181096174324e-282 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.0
Applied egg-rr2.9
if 8.5085764721221019e294 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 61.2
Applied egg-rr6.4
Final simplification2.4
herbie shell --seed 2022125
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))