11-27-2022, 09:02 PM
Remember, MOD takes the closest multiple of your number, and then gives the remainder.
So 13 MOD 5...
10 is the closest multiple of 5...
13 - 10 = 3
In the case of -7 MOD 5...
-5 is the closest multiple of 5...
-7 - -5 = -2
MOD is giving the proper results by this logic. You're just not used to thinking of it in such a manner.
So 13 MOD 5...
10 is the closest multiple of 5...
13 - 10 = 3
In the case of -7 MOD 5...
-5 is the closest multiple of 5...
-7 - -5 = -2
MOD is giving the proper results by this logic. You're just not used to thinking of it in such a manner.