This topic is now archived and is closed to further replies.

logic monkey

explain x % 32 = x

Recommended Posts

logic monkey    122
ok, lets assume x = 6. 32 % x = 2 ok, gotcha 32/6 = 5 and the remainer is 2 but x % 32 = x Now I would think it''d be 0 any time x is modded by a larger number since the result would be fractional (.1875 in this case) and assuming you were using an int type that would resolve to 0. Ok, so I must''ve have strayed off the logic-path somewhere and the answer is probably really simple. Can someone tell me where and why? Thanks

Share this post

Link to post
Share on other sites
Kentaro    122
No, logic monkey is correct.

32 % 6 = 2 is equivalent to 32 = 5 x 6 + 2
Do the long division yourself and you'll see.

36 % 6 = 0, but 36 doesn't get mentioned here.....

EDIT: The person I was answering seems to have deleted his post.... Oh well.

Over the centuries, mankind has tried many ways of combating the forces of evil...prayer,
fasting, good works and so on. Up until Doom, no one seemed to have thought about the
double-barrel shotgun. Eat leaden death, demon...
-- Terry Pratchett

[edited by - Kentaro on August 31, 2003 7:20:22 PM]

Share this post

Link to post
Share on other sites