Mathf.Repeat in ShaderLab?

Hello, i looked around but couldn’t find a shader intrinsic function that does what mathf.repeat does. Do you know if there is one?

There are several solutions:

Note while fmod and modf directly returns the remainder, frac has to be used like this:

num = frac(num/range) * range;

floor could be used like this:

num /= range;
num = (num - floor(num)) * range;

Though fmod would be the simplest implementation

num = fmod(num, range);