\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}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2 \cdot \frac{t_0}{b2}\\
\mathbf{elif}\;t_1 \leq -2.0541893291628116 \cdot 10^{-288}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{t_2}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \frac{t_0}{\sqrt[3]{b2}}\\
\mathbf{elif}\;t_1 \leq 1.2274224996005442 \cdot 10^{+303}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{b2}{a1 \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 (/ a2 (cbrt b1)))
(t_1 (/ (* a1 a2) (* b1 b2)))
(t_2 (/ a1 (* (cbrt b1) (cbrt b1)))))
(if (<= t_1 (- INFINITY))
(* t_2 (/ t_0 b2))
(if (<= t_1 -2.0541893291628116e-288)
t_1
(if (<= t_1 0.0)
(* (/ t_2 (* (cbrt b2) (cbrt b2))) (/ t_0 (cbrt b2)))
(if (<= t_1 1.2274224996005442e+303)
t_1
(/ 1.0 (/ b2 (* a1 (/ 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 = a2 / cbrt(b1);
double t_1 = (a1 * a2) / (b1 * b2);
double t_2 = a1 / (cbrt(b1) * cbrt(b1));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2 * (t_0 / b2);
} else if (t_1 <= -2.0541893291628116e-288) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (t_2 / (cbrt(b2) * cbrt(b2))) * (t_0 / cbrt(b2));
} else if (t_1 <= 1.2274224996005442e+303) {
tmp = t_1;
} else {
tmp = 1.0 / (b2 / (a1 * (a2 / b1)));
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.0 |
|---|---|
| Target | 11.1 |
| Herbie | 2.5 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
Applied associate-/r*_binary6436.7
Applied *-un-lft-identity_binary6436.7
Applied add-cube-cbrt_binary6437.2
Applied times-frac_binary6417.9
Applied times-frac_binary6410.4
Simplified10.4
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -2.05418932916281163e-288 or -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 1.2274224996005442e303Initial program 0.8
Applied associate-/r*_binary647.9
Taylor expanded in a1 around 0 0.8
if -2.05418932916281163e-288 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 13.0
Applied associate-/r*_binary646.7
Applied add-cube-cbrt_binary646.8
Applied add-cube-cbrt_binary646.9
Applied times-frac_binary643.8
Applied times-frac_binary642.4
if 1.2274224996005442e303 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 63.3
Applied associate-/r*_binary6446.4
Applied *-un-lft-identity_binary6446.4
Applied times-frac_binary6414.2
Simplified14.2
Applied clear-num_binary6414.2
Final simplification2.5
herbie shell --seed 2022097
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))