
-----------------------------------
GlobeTrotter
Wed Mar 30, 2005 6:22 pm

Difference Between Mod and Rem
-----------------------------------
Don't they both give the remainder?  For example, using the example that comes w/ turing, changing the mod and rem doesn't effect the program.

-----------------------------------
person
Wed Mar 30, 2005 6:30 pm


-----------------------------------
try negatives

-----------------------------------
jamonathin
Wed Mar 30, 2005 6:35 pm


-----------------------------------
This example if from the turing help file (edited a bit), and when the number is positive, they both do the same, but when the number is negative, mod tells you how many you need to get the other number, and rem tell you how much you are over the last time you matched that other number.  Buttt, i could be wrong  :? 

var eggCount : int
get eggCount
put "You have ", eggCount div 12, " dozen eggs"
put "You have ", eggCount mod 12, " left over - mod"
put "You have ", eggCount rem 12, " left over - rem"


-----------------------------------
GlobeTrotter
Wed Mar 30, 2005 6:38 pm


-----------------------------------
Thanks

-----------------------------------
jamonathin
Wed Mar 30, 2005 6:39 pm


-----------------------------------
wow that was a fast respond... :!:
