My book follows the following method
Let
$$I=\int_0^{\pi \over 2} \lfloor \tan(x) \rfloor\, dx.$$
Then using King's rule $$\int_{a}^{b}f(x)dx=\int_{a}^{b}f(a+b-x)dx$$ we have
$$I=\int_0^{\pi \over 2} \lfloor \tan(\pi- x)\rfloor\, dx=\int_0^{\pi \over 2} \lfloor \tan(- x)\rfloor\, dx$$
Adding the above two we get:
$$2I =\int_0^{\pi\over 2} \left[\lfloor(\tan(- x)\rfloor+\lfloor\tan x\rfloor\right]\,dx$$
Now since $ \lfloor x\rfloor +\lfloor -x\rfloor=-1$ when $x$ is not a integer and $0$ otherwise the integral becomes
$$2I=\int_0^{\pi\over 2} -1\, dx$$
which then gives $I = {-\pi \over 2}$
But Wolfram Alpha says that the integral does not converge.
My Question:
Is my book correct? If not where is the error in above calculations?
Your application of King's rule is wrong; it gives$$I=\int_0^{\pi/2}\lfloor\tan(\color{blue}{\pi/2}-x)\rfloor dx.$$To prove $I$ diverges, note$$I\ge\int_0^{\pi/2}(\tan x-1)dx=[\ln|\sec x|-x]_0^{\pi/2}=\infty.$$