I was always taught that if a function's derivative is always $0$ on an interval $(a,b)$ then the function is constant on $(a,b)$. And all the information online points to that conclusion as well - in fact, it's proved here!
Yet, when I mentioned it an a conversation with the calculus teacher at our school, he mysteriously told me to look at the function: $$f(x) = \arctan(x)+\arctan(\frac{1}{x})$$
And looking at it, it indeed seems to contradict this theorem. A simple application of the chain rule shows $f'(x)=0$, yet, $f(1)\neq f(-1)$.
Is this apparent contradiction a flaw in the "constant derivative theorem" or am I missing something? How could one amend the statement of the theorem to repair such contradictions?