\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:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt[3]{\frac{a2}{b2}}\\
\left(\left(\sqrt[3]{a1} \cdot \sqrt[3]{a1}\right) \cdot \left(t_1 \cdot t_1\right)\right) \cdot \frac{\sqrt[3]{a1}}{\frac{b1}{t_1}}
\end{array}\\
\mathbf{elif}\;t_0 \leq -1.5248764427209305 \cdot 10^{-302}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{1}{\frac{b1}{a2}} \cdot \frac{a1}{b2}\\
\mathbf{elif}\;t_0 \leq 2.4128988234850523 \cdot 10^{+246}:\\
\;\;\;\;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))
(let* ((t_1 (cbrt (/ a2 b2))))
(* (* (* (cbrt a1) (cbrt a1)) (* t_1 t_1)) (/ (cbrt a1) (/ b1 t_1))))
(if (<= t_0 -1.5248764427209305e-302)
t_0
(if (<= t_0 0.0)
(* (/ 1.0 (/ b1 a2)) (/ a1 b2))
(if (<= t_0 2.4128988234850523e+246) 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)) {
double t_1_1 = cbrt(a2 / b2);
tmp = ((cbrt(a1) * cbrt(a1)) * (t_1_1 * t_1_1)) * (cbrt(a1) / (b1 / t_1_1));
} else if (t_0 <= -1.5248764427209305e-302) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (1.0 / (b1 / a2)) * (a1 / b2);
} else if (t_0 <= 2.4128988234850523e+246) {
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.0 |
|---|---|
| Target | 11.1 |
| Herbie | 2.6 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
Applied associate-/l*_binary6431.4
Simplified17.0
Applied add-cube-cbrt_binary6417.7
Applied *-un-lft-identity_binary6417.7
Applied times-frac_binary6417.7
Applied add-cube-cbrt_binary6417.9
Applied times-frac_binary6410.6
Simplified10.7
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.5248764427209305e-302 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 2.4128988234850523e246Initial program 0.8
Applied times-frac_binary6415.9
Taylor expanded in a1 around 0 0.8
if -1.5248764427209305e-302 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.0
Applied associate-/l*_binary647.0
Simplified3.9
Applied associate-/r/_binary644.0
Applied *-un-lft-identity_binary644.0
Applied times-frac_binary642.6
if 2.4128988234850523e246 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 48.4
Applied times-frac_binary6411.3
Final simplification2.6
herbie shell --seed 2022104
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))