
-----------------------------------
person
Mon Jan 31, 2005 2:30 pm

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

-----------------------------------
md
Mon Jan 31, 2005 3:09 pm


-----------------------------------
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 [url=http://www.google.ca/]google.

-----------------------------------
basketball4ever
Mon Jan 31, 2005 3:12 pm


-----------------------------------
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
Mon Jan 31, 2005 3:14 pm


-----------------------------------
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
Mon Jan 31, 2005 3:22 pm


-----------------------------------
yea got it ~!~!~!
4 mod [anything greater than 4] = 4

its the other way around if you want to find the remainder. xD

-----------------------------------
Viper
Sat Feb 05, 2005 1:26 pm


-----------------------------------
if your jus trying to divide its probably easier to us div (not recommended for int)

-----------------------------------
Bacchus
Sat Feb 05, 2005 3:11 pm


-----------------------------------
div works with int and it probably the best to use cause it rounds it to closes integer, / on the other hand doesnt

-----------------------------------
Cervantes
Sun Feb 06, 2005 9:00 am


-----------------------------------
div works with int and it probably the best to use cause it rounds it to closes integer, / on the other hand doesnt
Careful:

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.



put 5 / 3
put 5 div 3


-----------------------------------
Bacchus
Sun Feb 06, 2005 9:28 am


-----------------------------------
ok so it rounds down :P

-----------------------------------
bugzpodder
Sun Feb 06, 2005 11:02 am


-----------------------------------
whats


5 mod -2
-5 mod -2

