
-----------------------------------
mirhagk
Mon Feb 22, 2010 11:21 pm

Mod vs Rem
-----------------------------------
Hey guys... this might sound dumb, but is there a difference betweent the rem operator and the mod operator??

-----------------------------------
TheGuardian001
Mon Feb 22, 2010 11:33 pm

Re: Mod vs Rem
-----------------------------------
They appear to work differently with combinations of negative and positive numbers, although I'm not sure why or how they differ, IE:

[code]

-12 rem 5 -> -2

-12 mod 5 -> 3

[/code]

-----------------------------------
mirhagk
Mon Feb 22, 2010 11:38 pm

RE:Mod vs Rem
-----------------------------------
alright lol, i was just kinda confused, i was building a prime number generator for an encryption program and i used mod, then i was looking at a previous one i made and it used rem... They don't seem to make a difference performance-wise and the output is the same, I was just curious lol, if anyone knows why let me know k

-----------------------------------
Euphoracle
Tue Feb 23, 2010 12:20 am

RE:Mod vs Rem
-----------------------------------
The rem operator is actually the remainder of the division operation.  The mod operator is the modulus operator.

Consider -12 mod 5.  Basically, it computes a number b, such that 0 