Code
foreach (long n; -5 .. 6) {
writefln("%2s %% %2s = %2s, %2s, %2s, %2s", n, 5, n % 5, n % BigInt(5), BigInt(n) % 5, BigInt(n) % BigInt(5));
}
outputs (note the second result column)
-5 % 5 = 0, 1, 0, 0
-4 % 5 = -4, 2, -4, -4
-3 % 5 = -3, 3, -3, -3
-2 % 5 = -2, 4, -2, -2
-1 % 5 = -1, 0, -1, -1
0 % 5 = 0, 0, 0, 0
1 % 5 = 1, 1, 1, 1
2 % 5 = 2, 2, 2, 2
3 % 5 = 3, 3, 3, 3
4 % 5 = 4, 4, 4, 4
5 % 5 = 0, 0, 0, 0
Clearly, that's not like the modulo should work on negative numbers - there is no way that 0 could be the remainder of the divison of -1 by 5. There is similar behavior on other modulos.
I tested this using DMD 2.052 on x86 and x86_64 linux systems.