Does there exist a smooth approximation of $x \bmod y$? I'm looking for a function $m(x,y)$ that smoothly approximates $x \bmod y$, and I'm assuming there would be some $n$ or $\varepsilon$ in the body of $m(x,y)$ that defines the degree of approximation such that as $n$ goes to infinity or $\varepsilon$ goes to zero, 
$$
m(x,y)= x \bmod y.
$$
I've looked at, for example, $\sin(x/y)$ and have been trying to figure out ways to make $\sin(x)$ more "steep" so that I can apply such techniques to $\sin(x/y)$ in order to perhaps more closely approximate $x \bmod y$.
The analogy I'm looking at is the approximation of $\mid x\mid$ as $\sqrt{x^2 + \varepsilon)}$ where epsilon is some small quantity.
Does a similarly smooth function exist for $x \bmod y$?
 A: Let $\theta=\pi x/y$. @user2249675's answer involves a term $\cot\theta=\cos\theta/\sin\theta$. We can construct a smooth approximation by replacing $1/\sin\theta$ with $\sin\theta/(\sin^2\theta+\epsilon^2)$, giving the final answer
$$m(x,y)=y\left(\frac12-\frac1\pi\arctan\left(\frac{\cos(\pi x/y)\sin(\pi x/y)}{\sin^2(\pi x/y)+\epsilon^2}\right)\right).$$
Here is a plot with $y=5$:

A: I think the fourier series for the sawtooth wave might be helpful here.
http://mathworld.wolfram.com/FourierSeriesSawtoothWave.html
The series is given by
$$x=\frac{L}{2}-\frac{L}{\pi}\sum_{n=1}^\infty\frac{1}{n}\sin\frac{2n\pi x}{L},\quad x\in(0,L).$$
If $x\notin(0,L)$, the Fourier series gives $x\mbox{ mod } L$, which is what is wanted here. Truncating at finite order gives a continuous approximation of $x\mbox{ mod }L$.
A: Here's a simple answer you can try:
$$m(x,y) = y\left(\frac{1}{2} - \frac{\arctan(\cot(\pi x/y))}{\pi}\right)$$
Plot with $y = 5$:

A: One approach I found was to find a smooth floor function, and then simply apply it to the equation:
$$
x \bmod y=x-{\lfloor}\frac{x}{y}{\rfloor}y
$$
And a definition for the smooth floor function I derived is:
$$
{\lfloor}\frac{x}{y}{\rfloor}=-\frac{1}{2} + x + a ln(1/a) -\frac{i}{2 \pi} \left[ln\left(1-e^\left(-2 i \pi \left(x+a 
 ln(1/a)\right)\right)+a\right) - ln\left(1-e^\left(2 i \pi \left(x+a 
 ln(1/a)\right)\right)+a\right) \right]
$$
As you make a smaller and smaller, this increasingly approximates the floor function.
Update
I realized after posting that @user856 had already posted a much simpler approximation quite a while ago.
