I'm trying to find a differentiable approximation of the "fract" function, which returns the fractional portion of a real number.
$y = x-\lfloor x\rfloor$
I have something that works "ok", that I got by adapting a bandlimited saw wave.
$y=0.5-\frac{sin(2\pi x)+sin(4\pi x)/2+sin(6\pi x)/3+sin(8\pi x)/4+sin(10\pi x)/5}{\pi}$
I can add more harmonics to make the band limited saw wave closer to the actual "fract" function, but for my usage case, all these trig function calls are getting pretty expensive.
I was curious, are there other (better quality / lower computational complexity) ways to differentiably approximate this function?