integer remainder?
yarisboy
Posts: 245
On page 260 of the manual I'm looking at "//" modulus. The example text talks about an "integer remainder". Looks like a real oxymoron. The remainder cited is .25. The example doesn't say if it is assigned as zero to x. In traditional PLC math .25 would store as a zero when assigned to an integer. If it is stored as .25 what data type is it? One more sentence: X is set equal to zero would make it clear, if that is the correct guess as to the result here. I looked up modulus in the dictionary. That was no help.
P.S. the book says: " If Y started out as 5 then y//4 equals 1, meaning the division of 5 by 4 results in a real real remainder whose
fractional component equals 1/4, or .25.
I'm terminally L.D.
Try this. After "equals 1" insert "and 1 is assigned to X." This finishes the description of what actually happens when using this code. If there are 4 sectors on the wheel and we made it all the way around the wheel plus .25 revolutions then we have .25 (the remainder) times 4 sectors per revolution equals 1.
Post Edited (yarisboy) : 8/24/2009 9:14:30 PM GMT
P.S. the book says: " If Y started out as 5 then y//4 equals 1, meaning the division of 5 by 4 results in a real real remainder whose
fractional component equals 1/4, or .25.
I'm terminally L.D.
Try this. After "equals 1" insert "and 1 is assigned to X." This finishes the description of what actually happens when using this code. If there are 4 sectors on the wheel and we made it all the way around the wheel plus .25 revolutions then we have .25 (the remainder) times 4 sectors per revolution equals 1.
Post Edited (yarisboy) : 8/24/2009 9:14:30 PM GMT
Comments
is the same as
a := x/z
y := x - a*z
when doing int / and *
Post Edited (yarisboy) : 8/24/2009 8:21:30 PM GMT