\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{\left(a2 \cdot \frac{\sqrt[3]{a1} \cdot \sqrt[3]{a1}}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}\right) \cdot \frac{\sqrt[3]{a1}}{\sqrt[3]{b1}}}{b2}\\
\mathbf{if}\;b1 \cdot b2 \leq -2.3720194052494554 \cdot 10^{+232}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b1 \cdot b2 \leq -5.062919740973674 \cdot 10^{-112}:\\
\;\;\;\;\frac{a2 \cdot a1}{b1 \cdot b2}\\
\mathbf{elif}\;b1 \cdot b2 \leq 0:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b1 \cdot b2 \leq 7.40266575556476 \cdot 10^{+200}:\\
\;\;\;\;a2 \cdot \frac{a1}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \frac{\frac{a1}{b1}}{\sqrt[3]{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 a1) (cbrt a1)) (* (cbrt b1) (cbrt b1))))
(/ (cbrt a1) (cbrt b1)))
b2)))
(if (<= (* b1 b2) -2.3720194052494554e+232)
t_0
(if (<= (* b1 b2) -5.062919740973674e-112)
(/ (* a2 a1) (* b1 b2))
(if (<= (* b1 b2) 0.0)
t_0
(if (<= (* b1 b2) 7.40266575556476e+200)
(* a2 (/ a1 (* b1 b2)))
(* (/ a2 (* (cbrt b2) (cbrt b2))) (/ (/ a1 b1) (cbrt 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(a1) * cbrt(a1)) / (cbrt(b1) * cbrt(b1)))) * (cbrt(a1) / cbrt(b1))) / b2;
double tmp;
if ((b1 * b2) <= -2.3720194052494554e+232) {
tmp = t_0;
} else if ((b1 * b2) <= -5.062919740973674e-112) {
tmp = (a2 * a1) / (b1 * b2);
} else if ((b1 * b2) <= 0.0) {
tmp = t_0;
} else if ((b1 * b2) <= 7.40266575556476e+200) {
tmp = a2 * (a1 / (b1 * b2));
} else {
tmp = (a2 / (cbrt(b2) * cbrt(b2))) * ((a1 / b1) / cbrt(b2));
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.6 |
|---|---|
| Target | 11.1 |
| Herbie | 4.8 |
if (*.f64 b1 b2) < -2.3720194052494554e232 or -5.06291974097367404e-112 < (*.f64 b1 b2) < -0.0Initial program 24.8
rmApplied associate-/r*_binary6412.9
Simplified8.2
rmApplied add-cube-cbrt_binary648.8
Applied add-cube-cbrt_binary648.9
Applied times-frac_binary648.9
Applied associate-*r*_binary645.8
if -2.3720194052494554e232 < (*.f64 b1 b2) < -5.06291974097367404e-112Initial program 3.8
rmApplied associate-/r*_binary6411.2
Simplified14.6
rmApplied *-un-lft-identity_binary6414.6
Applied times-frac_binary6410.6
Simplified10.6
Simplified3.6
Taylor expanded around 0 3.8
if -0.0 < (*.f64 b1 b2) < 7.40266575556476003e200Initial program 5.7
rmApplied associate-/r*_binary6412.5
Simplified14.4
rmApplied *-un-lft-identity_binary6414.4
Applied times-frac_binary6411.8
Simplified11.8
Simplified5.2
if 7.40266575556476003e200 < (*.f64 b1 b2) Initial program 15.6
rmApplied associate-/r*_binary647.7
Simplified4.6
rmApplied add-cube-cbrt_binary644.9
Applied times-frac_binary644.2
Final simplification4.8
herbie shell --seed 2021204
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))