Answer kk is not an integer.
If you exponentialize and factor the result of the
integral you get
Since -1 < kk < 0, exp(%i*%pi*kk) is complex. Hence,
the integral of a real-valued function is complex.
This integral uses rectzto%pi2 to evaluate it, which is
a rectangle of height 2*%pi. The algorithm seems
correct, but the result is clearly wrong.