Posted: Mon Jan 31, 2005 2:30 pm Post subject: 4 mod 6 = 4? 4 mod 8 = 4?
4 mod 6 = 4? 4 mod 8 = 4?
y does this happen?
i though mod returned a remainder
Sponsor Sponsor
md
Posted: Mon Jan 31, 2005 3:09 pm Post subject: (No subject)
er... perhaps because you are trying to get the remainder when 4 is divided by 6... which just so happens to be 4 as 4 is not divisible by 6... The same is true for 4 mod 8. If you are trying to get the remainder when 8 is divided by four then you should be using 8 mod 4.
If you still don't understand what's going on (and this isn't much of a description i must admit...) then I would recoment the ever helpful google.
basketball4ever
Posted: Mon Jan 31, 2005 3:12 pm Post subject: (No subject)
do you understand mod???
mod finds you the remainder...
since 4 isn't dividisble by 6 or 8... the remainder is going to be 4... its simple math.
person
Posted: Mon Jan 31, 2005 3:14 pm Post subject: (No subject)
Quote:
er... perhaps because you are trying to get the remainder when 4 is divided by 6... which just so happens to be 4 as 4 is not divisible by 6... The same is true for 4 mod 8. If you are trying to get the remainder when 8 is divided by four then you should be using 8 mod 4.
thanx, i get it now
typon
Posted: Mon Jan 31, 2005 3:22 pm Post subject: (No subject)
yea got it ~!~!~!
4 mod [anything greater than 4] = 4
its the other way around if you want to find the remainder. xD
Viper
Posted: Sat Feb 05, 2005 1:26 pm Post subject: (No subject)
if your jus trying to divide its probably easier to us div (not recommended for int)
Bacchus
Posted: Sat Feb 05, 2005 3:11 pm Post subject: (No subject)
div works with int and it probably the best to use cause it rounds it to closes integer, / on the other hand doesnt
Cervantes
Posted: Sun Feb 06, 2005 9:00 am Post subject: (No subject)
Bacchus wrote:
div works with int and it probably the best to use cause it rounds it to closes integer, / on the other hand doesnt
Careful:
Turing Help Reference wrote:
The div operator divides one number by another and produces the integer result, truncated in the direction of zero. For example, 7 div 2 produces 3 and -7 div 2 produces -3.
Turing:
put5 / 3 put5div3
Sponsor Sponsor
Bacchus
Posted: Sun Feb 06, 2005 9:28 am Post subject: (No subject)
ok so it rounds down
bugzpodder
Posted: Sun Feb 06, 2005 11:02 am Post subject: (No subject)