\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -4.9179948584692854 \cdot 10^{+302}:\\
\;\;\;\;a2 \cdot \frac{\frac{a1}{b1}}{b2}\\
\mathbf{elif}\;t_0 \leq -4.626874562349005 \cdot 10^{-299}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{a2}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \frac{\frac{a1}{b1}}{\sqrt[3]{b2}}\\
\mathbf{elif}\;t_0 \leq 1.8486007324360962 \cdot 10^{+306}:\\
\;\;\;\;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 -4.9179948584692854e+302)
(* a2 (/ (/ a1 b1) b2))
(if (<= t_0 -4.626874562349005e-299)
t_0
(if (<= t_0 0.0)
(* (/ a2 (* (cbrt b2) (cbrt b2))) (/ (/ a1 b1) (cbrt b2)))
(if (<= t_0 1.8486007324360962e+306) 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 <= -4.9179948584692854e+302) {
tmp = a2 * ((a1 / b1) / b2);
} else if (t_0 <= -4.626874562349005e-299) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a2 / (cbrt(b2) * cbrt(b2))) * ((a1 / b1) / cbrt(b2));
} else if (t_0 <= 1.8486007324360962e+306) {
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.6 |
|---|---|
| Target | 11.6 |
| Herbie | 2.4 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -4.9179948584692854e302Initial program 62.4
Applied associate-/r*_binary6432.6
Simplified15.9
Applied *-un-lft-identity_binary6415.9
Applied times-frac_binary6416.7
if -4.9179948584692854e302 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -4.62687456234900487e-299 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 1.84860073243609623e306Initial program 0.8
if -4.62687456234900487e-299 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.5
Applied associate-/r*_binary646.2
Simplified3.9
Applied add-cube-cbrt_binary644.0
Applied times-frac_binary642.8
if 1.84860073243609623e306 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 63.6
Applied times-frac_binary645.9
Final simplification2.4
herbie shell --seed 2021313
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))