\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \frac{a1}{\frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}}\\
\mathbf{elif}\;t_0 \leq -5 \cdot 10^{-324}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt[3]{\frac{a2}{b2}}\\
\frac{t_1 \cdot t_1}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}} \cdot \frac{a1}{\frac{\sqrt[3]{b1}}{t_1}}
\end{array}\\
\mathbf{elif}\;t_0 \leq 5.928194317570427 \cdot 10^{+301}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{b2} \cdot \frac{a1}{b1}\\
\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 (- INFINITY))
(*
(/ (* (cbrt a2) (cbrt a2)) (* (cbrt b2) (cbrt b2)))
(/ a1 (/ b1 (/ (cbrt a2) (cbrt b2)))))
(if (<= t_0 -5e-324)
t_0
(if (<= t_0 0.0)
(let* ((t_1 (cbrt (/ a2 b2))))
(*
(/ (* t_1 t_1) (* (cbrt b1) (cbrt b1)))
(/ a1 (/ (cbrt b1) t_1))))
(if (<= t_0 5.928194317570427e+301) t_0 (* (/ a2 b2) (/ a1 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 = (a1 * a2) / (b1 * b2);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((cbrt(a2) * cbrt(a2)) / (cbrt(b2) * cbrt(b2))) * (a1 / (b1 / (cbrt(a2) / cbrt(b2))));
} else if (t_0 <= -5e-324) {
tmp = t_0;
} else if (t_0 <= 0.0) {
double t_1 = cbrt(a2 / b2);
tmp = ((t_1 * t_1) / (cbrt(b1) * cbrt(b1))) * (a1 / (cbrt(b1) / t_1));
} else if (t_0 <= 5.928194317570427e+301) {
tmp = t_0;
} else {
tmp = (a2 / b2) * (a1 / b1);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.2 |
|---|---|
| Target | 11.3 |
| Herbie | 1.8 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
Applied associate-/l*_binary6428.0
Simplified16.9
Applied add-cube-cbrt_binary6417.6
Applied add-cube-cbrt_binary6417.8
Applied times-frac_binary6417.8
Applied *-un-lft-identity_binary6417.8
Applied times-frac_binary6413.9
Applied *-un-lft-identity_binary6413.9
Applied times-frac_binary6410.7
Simplified10.7
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -4.94066e-324 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 5.92819431757042689e301Initial program 0.7
Applied associate-/l*_binary647.8
Simplified14.4
Taylor expanded in a1 around 0 0.7
if -4.94066e-324 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.5
Applied associate-/l*_binary646.9
Simplified3.7
Applied add-cube-cbrt_binary643.9
Applied add-cube-cbrt_binary643.9
Applied times-frac_binary643.9
Applied *-un-lft-identity_binary643.9
Applied times-frac_binary641.9
Simplified1.8
if 5.92819431757042689e301 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 62.0
Applied times-frac_binary645.9
Final simplification1.8
herbie shell --seed 2022094
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))