Kyon
Member
Hi everyone, I was wondering why Modulo allows something to go negative.
Like:
400 % 360 = 40
but
-400 & 360 = -40
What if I want my modulo results to always be above 0.
So always between 0 and 360 in this case.
Kyon.
PS: I mean I know I can do it by making a seperate variable and check if it's below 0 and then make it positive. But I was wondering if there was a simpler mathematical solution
Like:
400 % 360 = 40
but
-400 & 360 = -40
What if I want my modulo results to always be above 0.
So always between 0 and 360 in this case.
Kyon.
PS: I mean I know I can do it by making a seperate variable and check if it's below 0 and then make it positive. But I was wondering if there was a simpler mathematical solution
Last edited: