I'm working on a project where I'm working with modulo functions. However, to continue, I need to integrate squares of a weighted sum of them (e.g of the form $\left(c+\operatorname{weighted sum} \right)^2$, with $c$ a real, positive constant). So, I first tried Fourier series. However, since the weights are pretty high, the errors blew up, and the amount of terms necessary to correct them are prohibitively high. So, I need another way to create the modulo functions.


This leads me to my question: just like the title says, is there some approximation of  $a \operatorname{mod} \left(\frac xb \right)$, $f(x)$ (with $a,b, \geq 1, \in \mathbb{R}$), that has an elementary, closed form antiderivative, has a scaling constant $N$ so that as $N \to \infty$, $|\operatorname{floor}(x)-f(x)| \to 0$ (hopefully $\sim \mathcal{O} \left(10^{-\operatorname{poly(N)}}\right)$ at least on $\{ k+0.1 \leq x \leq k+0.9, k=\{0,1,2..n\}\}$, with $n \in \mathbb{R}$, and has a constant number of terms $k$ that independent of $N,n,a,b$.