I want to calculate $\int_{-\infty}^\infty \frac{cos(\pi x)}{2x-1}dx$ using Cauchy's Residue Theorem.
First, since $\frac{cos(\pi x)}{2x-1} = Re(\frac{e^{i\pi x}}{2x-1})$, I can simply compute real part of the integral $\int_{-\infty}^\infty \frac{e^{i\pi x}}{2x-1}dx$. So I will use the positively oriented curve $\Gamma$ consisting of the interval $[-R, R]$ and the upper semicircle $\gamma^+(0, R)$ to integrate. The integrand has a simple pole at $x = \frac{1}{2}$. Using the formula for residues at simple poles, the residue at $x=\frac{1}{2}$ is $\frac{e^{i\pi x}}{2}|_{x=2} = \frac{e^{\frac{i\pi}{2} }}{2}$. So by Cauchy's Residue Theorem, $\int_{-\infty}^\infty \frac{e^{i\pi x}}{2x-1}dx$ = $Re(\int_\Gamma \frac{e^{i\pi x}}{2x-1}dx$) = Re($2\pi i \frac{(cos(\frac{\pi}{2})+i sin(\frac{\pi}{2})}{2})$ = $-\pi$.
But when I put this integral in a calculator, I get the result $\frac{-\pi}{2}$. Where have I gone wrong? Where do I get this half from? If the method I used cannot be applied, how can I calculate this integral in a similar way?