why this claim is wrong ? (as it leads to $\int_{0}^{\infty}\frac{\sin x}{x}dx=0$) let's define $\begin{array}{c}
f=\begin{cases}
\frac{\sin x}{x} & x\neq0\\
1 & x=0
\end{cases}\end{array}$
f is holomorphic on $\mathbb{C}$ as it equals to it's taylor series.
therefore, for each domain, according the residue theorem $\oint_{c}f$ it should be exactly 0, as there are no poles in any domain.
Where am I wrong. of course this result cannot be true as it implies that $\oint_{c}\frac{\sin x}{x}dx=0$ because they differ by a single point. this of course cannot be true as it implies $\intop_{0}^{\infty}\frac{\sin x}{x}dx=0\neq\frac{\pi}{2}$
 A: The OP has clarified in comments that they are thinking about taking the limit of $\oint_c f(z)\,dz$ where the closed contour $C$ is a half circle running from $-R$ to $+R$ and then back to $-R$ along the arc $z=Re^{i\theta}$ with $0\le\theta\le\pi$, as $R\to\infty$. They are correct that this limit is $0$, since the function $f(z)$ is holomorphic. But all this proves is that
$$\int_0^{\pi}{\sin(Re^{i\theta})\over Re^{i\theta}}Rie^{i\theta}\,d\theta=i\int_0^{\pi}\sin(Re^{i\theta})\,d\theta=-\int_{-R}^R{\sin x\over x}dx$$
hence
$$\lim_{R\to\infty}\int_0^{\pi}\sin(Re^{i\theta})\,d\theta=i\pi$$
The OP's error is in assuming that the integral over the semicircular arc tends to $0$ just because the arc is heading off to infinity and $\sin z\over z$ looks like it's getting small as $|z|$ gets large; in point of fact, for $z=iy$ (with $y$ real) we have $\left|\sin z\over z\right|={\sinh y\over y}\to\infty$ as $|y|\to\infty$, so the function is anything but small on portions of any large semicircular arc.
A: The error is in the last part. $\oint_C f(z) dz=0$ doesn't implies $\int_0^\infty f(z) dz = 0$.
A: I hope your function $f$ is a complex variable function $f(z)$ so that holomorphic makes some sense here.
The result $\oint_C f(z)dz=0$ is obviously true for some close contour $C$ like the union of real axis and  semicircular arc $\lvert z\lvert =1$ which doesn't imply that $\oint_C f(x)dx=0$ unless $f(x)=\frac{p(x)}{q(x)}$, where $p(x)$ and $q(x)$ are polynomials.
