Explicitly converting to double as MSVC can't work with fmod(int,int)