error when replacing sum by an integral I have seen that quite often in analytic number theory, one wants to replace a sum by an integral and then estimate the error. I saw the following estimate but I can't understand how to prove it.

Let $f$ be a differentiable function. Diving any interval $A< x <B$
   into intervals of lenght $1$ we obtain:     $$ \left | \int_A^B f(x)
 dx - \sum_{A < y < B} f(y) \right| \leq C  \left( (B-A) \max |f^{'}
 (x) | + \max |f(x)| \right) $$
where $C$ is a constant and the sum is over all integers betweeen $A$ and $B$.

Could someone some clue on how can I prove this? I suppose somehow we use Langange's Mean Valye Theorem because we can get 
$$ |f(x) - f(t) | \leq |x-t| \max |f^{'} (x) | $$
but I can't finish the proof.
Any help would be really appreciated.
 A: Euler-McLaurin summation formula states that if $f:\left(x,y\right]\rightarrow\mathbb{C}$
  is a differentiable function holds$$\sum_{x<n\leq y}f\left(n\right)=\int_{x}^{y}f\left(t\right)dt+\int_{x}^{y}\left\{ t\right\} f'\left(t\right)dt-\left\{ y\right\} f\left(y\right)+\left\{ x\right\} f\left(x\right)$$
 where $\left\{ t\right\}$ is the fractional part of $t$
  and $\left|\left\{ t\right\} \right|<1.$ So
  $$\left|\sum_{A<n\leq B}f\left(n\right)-\int_{A}^{B}f\left(t\right)dt\right|=\left|\int_{A}^{B}\left\{ t\right\} f'\left(t\right)dt-\left\{ B\right\} f\left(B\right)+\left\{ A\right\} f\left(A\right)\right|\leq\max_{A<t\leq B}\left|f'\left(t\right)\right|\left(B-A\right)+\left|\left\{ A\right\} f\left(A\right)-\left\{ B\right\} f\left(B\right)\right|\leq\max_{A<t\leq B}\left|f'\left(t\right)\right|\left(B-A\right)+2\max_{A<t\leq B}\left|f\left(t\right)\right|\leq2\left(\max_{A<t\leq B}\left|f'\left(t\right)\right|\left(B-A\right)+\max_{A<t\leq B}\left|f\left(t\right)\right|\right).$$
