Jump to content
  • Advertisement


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

logic monkey

explain x % 32 = x

This topic is 5410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!