V version: 0.1.11
OS: Parrot/Debian
What did you do?
Tried to use modulo to stay in positive boundaries f.e. for arrays
a := -5 %3
What did you expect to see?
a := -5 %3
print('$a')
1
What did you see instead?
a := -5 %3
print('$a')
-2
I guess it just computed the number as it were positive.
Interesting, running it with C/Go returns -2, running it with Python returns 1.
So I guess different languages have different ways to handle negative modulos.
Since C99, '%' clearly means 'remainder', not 'modulo'.
-5 / 3 yields -1, because division is truncated towards zero, not towards the smaller integer.
-5 % 3 yields -2, because (-5) - (3*(-1)) = -2
In Python, '%' means 'modulo'.

Ah, yes, for modulo there is a library function called 'modf()' in C.
V's behavior will be the same as in Go and C.
math.modf will be added once functions can return multiple values.
Most helpful comment
Since C99, '%' clearly means 'remainder', not 'modulo'.
-5 / 3 yields -1, because division is truncated towards zero, not towards the smaller integer.
-5 % 3 yields -2, because (-5) - (3*(-1)) = -2
In Python, '%' means 'modulo'.