PDA

View Full Version : Mod()...?


ABC123

G Gabriel
02-26-2007, 02:11 PM
?mod(2,3)
=2

How so?

Selwyn Rabins
02-26-2007, 02:16 PM
?mod(2,3)
=2

How so?

it is correct. 3 goes into 2 zero times with a remainder of 2.

G Gabriel
02-26-2007, 02:22 PM
Selwyn;
Thanks. I knew it's correct but was not sure if it is the right explantion.

gschepp
02-26-2007, 02:23 PM
I would imagine that 3 goes into 2 (or 20) 6 times making it 20-18 =2

gschepp
02-26-2007, 02:25 PM
Ahh that's how it works when number size is reversed

G Gabriel
02-26-2007, 02:25 PM
Gary:
No, that explanation won't work.
?mod(1,8)
=1

csda1
02-26-2007, 02:54 PM
INT(1/8)=0 with remainder of 1. 1 is the answer

mod(x,n) is equivalent to

x-(INT(x/n)*n)
Negative numbers also work, although the result is negative (as it should be)

G Gabriel
02-26-2007, 03:09 PM
?mod(34,4)
=2

?mod(-34,4)
=2

AaronBBrown
02-27-2007, 10:33 AM
Selwyn;
Thanks. I knew it's correct but was not sure if it is the right explantion.

Actually, it is the right explanation. If you need further explanation on how modulo operations work, google will provide you with a number of links.

G Gabriel
02-27-2007, 10:43 AM
Aaron:
Thanks. I realized after Selwyn's reply that it is the right explanation. When I posted the question, I wasn't sure.