# How can the integral of $|\sin(x)|$ be $-\cos(x)\text{sgn}(\sin(x))$?

Wolfram|Alpha tells me that $\int|\sin(x)| = -\cos(x)\text{sgn}(\sin(x))$ (which happens to also be its derivative), but I don't understand how this is possible, because the resulting function jumps back to $-1$ at every $\pi$, although the $|\sin(x)|$ never goes below $0$. Also, an integral should always be continuous, and this one isn't.

It seems like the integral is missing $2\lfloor\frac{x}{\pi}\rfloor +1$. Is Wolfram|Alpha wrong, or is there something I'm not aware of?

• $\text{sgn}(\sin(\pi))=0$, so $-\cos(\pi)\text{sgn}(\sin(\pi))=0$, not $-1$. – vadim123 Oct 18 '14 at 22:32