Cheat Engine
The Official Site of Cheat Engine

Author Message
Ax3l
Cheater
Reputation: 1

Joined: 22 May 2011
Posts: 37

Posted: Sun Jun 19, 2011 7:31 am    Post subject: Modulus operator

Hey , I really want to know what the modulus operator is, because I tried to understand this months before , and after hours I still dont' know

I googled and it says the modulus operator returns the remainder of division of a number by another one.

but I don't get it , I tried alot in C++

 Code: int a=2,b=3,c;     c= a%b;

it returns 2

but how ? 2 /3 = 0.6666 or 1

when I assigned 100 to a it returned 1

again I don't understand , 100/3 = 33

EDIT : Never mind I GET IT

100/3 = 33
33*3 =99
100-99 =1

something like that
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

 Posted: Sun Jun 19, 2011 8:52 am    Post subject: When two is divided by three, three cannot go into two even once. Therefore, the remainder is two.
AhMunRa
Grandmaster Cheater Supreme
Reputation: 27

Joined: 06 Aug 2010
Posts: 1117

 Posted: Mon Jun 20, 2011 11:36 am    Post subject: @OP it rounds up, 100 / 3 is 33.3333333333333333 the .33333333333333 rounded to 1 is the modulous of 100 / 3. _________________ Bah that was supposed to say 'not saying its dead' lol. Fixing >.>
Dark Byte
Reputation: 385

Joined: 09 May 2003
Posts: 23240
Location: The netherlands

 Posted: Mon Jun 20, 2011 12:37 pm    Post subject: 100 % 6 = 4 _________________Do not ask me about online cheats. I don't know any and wont help finding them. Like my help? Join me on Patreon so i can keep helping
Ax3l
Cheater
Reputation: 1

Joined: 22 May 2011
Posts: 37

Posted: Mon Jun 20, 2011 1:33 pm    Post subject:

 AhMunRa wrote: @OP it rounds up, 100 / 3 is 33.3333333333333333 the .33333333333333 rounded to 1 is the modulous of 100 / 3.

Doesn't it round down ?

100/3 = 33.3333333
34*3 = 102

_________________
Dark Byte
Reputation: 385

Joined: 09 May 2003
Posts: 23240
Location: The netherlands

 Posted: Mon Jun 20, 2011 1:55 pm    Post subject: you had it correct in the first posts. Modulus is what is left after being divided by the given value _________________Do not ask me about online cheats. I don't know any and wont help finding them. Like my help? Join me on Patreon so i can keep helping
lucidity
Reputation: 0

Joined: 16 Feb 2011
Posts: 91

 Posted: Mon Jun 20, 2011 1:56 pm    Post subject: Modulus is not simply rounding the decimal portion of the quotient up, consider: 200 / 3 = 66.66666666666 Remainder is 0.6666666666, rounded up is 1 200 - 1 = 199 199 / 3 = 66.33333333333, which is incorrect Modulus is truncated rounding of the quotient and returning the remainder: 200 / 3 = 66.66666666666 Truncating the quotient, you get 66. 200 - (3 * 66) = 2 200 - 2 = 198 198 / 3 = 66, which is correct _________________» Antec Twelve Hundred Full Tower » EVGA E760 CLASSIFIED » EVGA GeForce GTX 580 SuperClocked 1536MB » i7-980XE » CORSAIR DOMINATOR 6GB PC3 12800 DDR3 » OS: Intel X25-M SSD » Game Storage: Raid-0 2 x WD VelociRaptor 10000 RPM » CE Cache Drive: 500GB WD Caviar » Power Supply: OCZ Z Series Gold 1000W
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 6 Hours Page 1 of 1

 Jump to: Select a forum Cheat Engine----------------Cheat EngineCheat Engine MacOSCheat Engine Lua ScriptingCheat Engine ExtensionsCheat Engine TutorialsGeneral GamehackingAuto Assembler tutorialsPointer tutorialsGame specific tutorialsWebbrowser stuff related tutorialsConsole ModdingLUA Tutorials General Discussions----------------General DiscussionsArtComputer TalkRandom spamArt RequestsArt TutorialsWillekeurige RotzooiGuestsHorse Excrement Cheat Requests----------------Single player cheat request Cheat Engine Downloads----------------TablesTrainersAuto Assemble scripts Coding----------------Cheat Engine SourceCETC Server and ClientsDBVMPlugin developmentGeneral programmingBinariesCrackmesGeneral programming+Game Development2D Graphics3D ModelingGameplay designWeb Development Games----------------Flash GamesGaia OnlineStick Arena Hello Kitty Forums----------------Temp
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum