Sorry for the 5-year necroposting, but I been googling furiously for half an hour to figure out how Unreal handles negative numbers on modulo. And this thread is the only relevant result.
The behavior of mod is highly inconsistent over different languages and math libraries.
And I agree the backwards wrapping variant is the most convenient one.
Unreal Engine uses the same modulo as in C++, and C++ rounds toward zero. What does that mean?
Well, the modulo formula is ((a/b) - round(a/b)) * b. When we round in the “normal” modulo, we round towards negative infinity.
So, this explains why UE4’s mod is kinda weird:
Normal mod: ((-0.25) - (-1)) * 4 = 3.
C++ mod: ((-0.25) - (0)) * 4 = -1.
Hope it helped.