\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a2}{\sqrt[3]{b1}}\\
t_1 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
t_2 := \frac{a1}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}\\
t_3 := \frac{t_2 \cdot t_0}{b2}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_1 \leq -7.610924163598907 \cdot 10^{-298}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_1 \leq 1.947699555580729 \cdot 10^{+288}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{\frac{1}{b1}}{b2}\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \frac{t_0}{b2}\\
\end{array}
(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(let* ((t_0 (/ a2 (cbrt b1)))
(t_1 (/ (* a1 a2) (* b1 b2)))
(t_2 (/ a1 (* (cbrt b1) (cbrt b1))))
(t_3 (/ (* t_2 t_0) b2)))
(if (<= t_1 (- INFINITY))
t_3
(if (<= t_1 -7.610924163598907e-298)
t_1
(if (<= t_1 0.0)
t_3
(if (<= t_1 1.947699555580729e+288)
(* (* a1 a2) (/ (/ 1.0 b1) b2))
(* t_2 (/ t_0 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 = a2 / cbrt(b1);
double t_1 = (a1 * a2) / (b1 * b2);
double t_2 = a1 / (cbrt(b1) * cbrt(b1));
double t_3 = (t_2 * t_0) / b2;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_1 <= -7.610924163598907e-298) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = t_3;
} else if (t_1 <= 1.947699555580729e+288) {
tmp = (a1 * a2) * ((1.0 / b1) / b2);
} else {
tmp = t_2 * (t_0 / b2);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.5 |
|---|---|
| Target | 11.7 |
| Herbie | 3.1 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or -7.61092416359890659e-298 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 18.8
Applied associate-/r*_binary649.9
Applied add-cube-cbrt_binary6410.1
Applied times-frac_binary645.2
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -7.61092416359890659e-298Initial program 0.9
if -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 1.94769955558072912e288Initial program 1.0
Applied associate-/r*_binary647.6
Applied *-un-lft-identity_binary647.6
Applied div-inv_binary647.6
Applied times-frac_binary641.5
if 1.94769955558072912e288 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 58.6
Applied associate-/r*_binary6447.6
Applied *-un-lft-identity_binary6447.6
Applied add-cube-cbrt_binary6447.8
Applied times-frac_binary6413.6
Applied times-frac_binary646.8
Simplified6.8
Final simplification3.1
herbie shell --seed 2021224
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))