0 Members and 2 Guests are viewing this topic.
% Stands for modulo (though it can have other uses too)a % b == a - math.floor(a/b)*b
[05:43:41] <+OmnomIRC> (O)<Xeda112358> Yeah, are you familiar with modulo? [05:44:28] <+OmnomIRC> (O)<Xeda112358> It is the remainder after a division, so when you do A-2floor(A/2), you get the remainder after dividing by 2 [05:46:41] <+OmnomIRC> (O)<Jonius7> I know it's the remainder, however need to work out how A-2floor(A/2) works out to be the remainder [05:46:55] <+OmnomIRC> (O)<Xeda112358> Ah, okay [05:47:12] <+OmnomIRC> (O)<Xeda112358> So, say you divide a number by 2 and you drop the decimal [05:47:39] <+OmnomIRC> (O)<Xeda112358> When you multiply by 2, you have the highest number up to A that is divisible by 2 [05:47:48] <+OmnomIRC> (O)<Jonius7> Oh I've got it I think [05:47:56] <+OmnomIRC> (O)<Xeda112358> :D [05:48:06] <+OmnomIRC> (O)<Jonius7> I'll draw a diagram and post it somewhere [05:48:22] <+OmnomIRC> (O)<Xeda112358> *cough* posting addiction *cough* ? [05:48:42] <+OmnomIRC> (O)<Jonius7> Oh. Everyone's been noticing lol [05:48:46] <+OmnomIRC> (O)<ruler501> Its not an addiction till you have >500 a month :P [05:49:09] <+OmnomIRC> (O)<Xeda112358> Anywho, by definition, A=2N+B [05:49:12] <+OmnomIRC> (O)<Jonius7> well yes and no. [05:49:15] <+OmnomIRC> (O)<Xeda112358> For some N and B [05:49:19] <+OmnomIRC> (O)<Jonius7> depends how long you get addicted ruler [05:49:39] <+OmnomIRC> (O)<Jonius7> Yeah [05:50:06] <+OmnomIRC> (O)<Xeda112358> So (A-2N)=B [05:50:16] <+OmnomIRC> (O)<ruler501> Jonius7true [05:50:19] <+OmnomIRC> (O)<Xeda112358> we find N by doing floor(A/2) :3 [05:50:33] <+OmnomIRC> (O)* Xeda112358 <3 math [05:51:12] <+OmnomIRC> (O)<Jonius7> The A-2floor(A/2) works out the difference between the actual number and the floor of the quotient *multiplied by the floor of the quotient or something rather [05:51:24] <+OmnomIRC> (O)<Xeda112358> yes [05:52:07] <+OmnomIRC> (O)<Jonius7> yay. I really needed to understand that somehow. [05:54:06] <+OmnomIRC> (O)<Jonius7> are modulo and modulus the same? [05:54:43] <+OmnomIRC> (O)<Xeda112358> Pretty much [05:55:04] <+OmnomIRC> (O)<Xeda112358> I just say "mod" [05:55:19] <+OmnomIRC> (O)<Xeda112358> like "a mod b" [05:59:46] <+OmnomIRC> (O)<Jonius7> I like modulus over modulo because I have seen it more often, but yeah, mod is good for shorthand [06:00:17] <+OmnomIRC> (O)<Jonius7> or... [06:00:28] <+OmnomIRC> (O)<Jonius7> Maybe modulus is the function, but modulo is the symbol [06:00:45] <+OmnomIRC> (O)* Xeda112358 has to go to class D: [06:32:11] <+OmnomIRC> (O)<Jonius7> meh modulus and modulo are different [06:37:53] <+OmnomIRC> (O)<Jonius7> modulo is the whole function, whereas modulus refers to the remainder
Wowow wait. The modulus is not the remainder. It often is, but not when negative numbers are involved. The modulus has the sign of the divisor, the remainder has the sign of the dividend.