Public Group

#### Archived

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

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

## 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 on other sites
Really simple, you almost got it. You just got the 0 part in the wrong place.

x=6
6 / 32 = 0 and the remainder is 6 (which is x)

Sander Maréchal

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

1. 1
2. 2
3. 3
4. 4
Rutin
16
5. 5

• 12
• 9
• 12
• 37
• 12
• ### Forum Statistics

• Total Topics
631415
• Total Posts
2999965
×