MOD Operator
-
OK, there doesn't seem to be a concise definition of this anywhere, particularly on MS's pathetic excuse for help. With the Mod operator, I've always thought that it return everything after the decimal point. Eg, 12 / 5 = 2.4 Therefore I'd expect 12 Mod 5 = 4 In practice, the result seems to be a random number, dependant on the current temparature in Kelvin, the number of times you have double clicked in the last six seconds and a random number between 12 and 47. From some testing... 12 Mod 5 = 2 ?? :mad: In fact, from the source code on MSDN, they say that 10 Mod 3 = 1 All I really need it for is working out if a Byte is even or not. If anyone can dare to explain, I'm sure it'll be useful.
Yet another spam post on yet another forum! I am the lazy one, who sleeps as it suits him, codes what he wishes, and has many years to look forward to. I love being a student.
-
OK, there doesn't seem to be a concise definition of this anywhere, particularly on MS's pathetic excuse for help. With the Mod operator, I've always thought that it return everything after the decimal point. Eg, 12 / 5 = 2.4 Therefore I'd expect 12 Mod 5 = 4 In practice, the result seems to be a random number, dependant on the current temparature in Kelvin, the number of times you have double clicked in the last six seconds and a random number between 12 and 47. From some testing... 12 Mod 5 = 2 ?? :mad: In fact, from the source code on MSDN, they say that 10 Mod 3 = 1 All I really need it for is working out if a Byte is even or not. If anyone can dare to explain, I'm sure it'll be useful.
Yet another spam post on yet another forum! I am the lazy one, who sleeps as it suits him, codes what he wishes, and has many years to look forward to. I love being a student.
MOD Returns the remainder left over after the first number is divided by the second number 12/5 is 2 with a remainder of 2 Therefore 12 MOD 5 is 2 10/3 is 3 with a remainder of 1 Therefore 10 MOD 3 is 1 and so forth. Don
-
MOD Returns the remainder left over after the first number is divided by the second number 12/5 is 2 with a remainder of 2 Therefore 12 MOD 5 is 2 10/3 is 3 with a remainder of 1 Therefore 10 MOD 3 is 1 and so forth. Don
So it's the actual difference...dang. Been thinking in decimal too long. Well that was clever - especially since it's only taken me 3 years to notice... Ooo...this could have new uses. Thanks muchly.
Yet another spam post on yet another forum! I am the lazy one, who sleeps as it suits him, codes what he wishes, and has many years to look forward to. I love being a student.
-
So it's the actual difference...dang. Been thinking in decimal too long. Well that was clever - especially since it's only taken me 3 years to notice... Ooo...this could have new uses. Thanks muchly.
Yet another spam post on yet another forum! I am the lazy one, who sleeps as it suits him, codes what he wishes, and has many years to look forward to. I love being a student.
Yuppers such as a quick and dirty way to check to see if the current minute is a multiple of 5 without all the fancy if minute/5 = int(minute/5) and so forth. Use it for all sorts of cool stuff. Glad to be of help...
-
OK, there doesn't seem to be a concise definition of this anywhere, particularly on MS's pathetic excuse for help. With the Mod operator, I've always thought that it return everything after the decimal point. Eg, 12 / 5 = 2.4 Therefore I'd expect 12 Mod 5 = 4 In practice, the result seems to be a random number, dependant on the current temparature in Kelvin, the number of times you have double clicked in the last six seconds and a random number between 12 and 47. From some testing... 12 Mod 5 = 2 ?? :mad: In fact, from the source code on MSDN, they say that 10 Mod 3 = 1 All I really need it for is working out if a Byte is even or not. If anyone can dare to explain, I'm sure it'll be useful.
Yet another spam post on yet another forum! I am the lazy one, who sleeps as it suits him, codes what he wishes, and has many years to look forward to. I love being a student.