You can avoid the singularity at the origin by making the contour C take a small detour to avoid it. More precisely, replace the straight line section of C (going from –1 to +1) by three segments defined as follows. First, a straight line segment going from –1 to –ε, then a semicircle given by

, with θ going from π to 0, and finally a straight line segment from +ε to +1. The integral round this modified contour will be 0 (by Cauchy's theorem), and as

the integral round the modified integral will tend to the original integral round C. The reason for this is that the function f(z) is small when z is close to 0, so the integrals round parts of the contours near the origin will also be small.