\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
t_1 := \frac{\frac{a1}{b1}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \frac{a2}{\sqrt[3]{b2}}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -6.916235610315 \cdot 10^{-312}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 5.041403853359531 \cdot 10^{-289}:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\
\mathbf{elif}\;t_0 \leq 7.488614284566524 \cdot 10^{+190}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{\frac{1}{b1}}{b2}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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)))
(t_1 (* (/ (/ a1 b1) (* (cbrt b2) (cbrt b2))) (/ a2 (cbrt b2)))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -6.916235610315e-312)
t_0
(if (<= t_0 5.041403853359531e-289)
(/ (* a1 (/ a2 b2)) b1)
(if (<= t_0 7.488614284566524e+190)
(* (* a1 a2) (/ (/ 1.0 b1) b2))
t_1))))))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 t_1 = ((a1 / b1) / (cbrt(b2) * cbrt(b2))) * (a2 / cbrt(b2));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -6.916235610315e-312) {
tmp = t_0;
} else if (t_0 <= 5.041403853359531e-289) {
tmp = (a1 * (a2 / b2)) / b1;
} else if (t_0 <= 7.488614284566524e+190) {
tmp = (a1 * a2) * ((1.0 / b1) / b2);
} else {
tmp = t_1;
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.2 |
|---|---|
| Target | 11.4 |
| Herbie | 3.7 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or 7.48861428456652416e190 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 46.1
Applied times-frac_binary6411.7
Applied add-cube-cbrt_binary6412.5
Applied *-un-lft-identity_binary6412.5
Applied times-frac_binary6412.5
Applied associate-*r*_binary6414.2
Simplified14.2
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -6.9162356103149e-312Initial program 0.8
if -6.9162356103149e-312 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 5.0414038533595308e-289Initial program 12.5
Applied times-frac_binary642.3
Applied associate-*l/_binary643.7
if 5.0414038533595308e-289 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 7.48861428456652416e190Initial program 0.8
Applied associate-/r*_binary646.6
Applied *-un-lft-identity_binary646.6
Applied div-inv_binary646.7
Applied times-frac_binary641.1
Final simplification3.7
herbie shell --seed 2022019
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))