Mirage Source http://miragesource.net/forums/ |
|
Shutdown http://miragesource.net/forums/viewtopic.php?f=210&t=546 |
Page 2 of 2 |
Author: | pingu [ Sat Sep 23, 2006 8:49 pm ] |
Post subject: | |
Look, I managed to think up a formula to help you. If you do: Num1 Mod Num2 It translates to: Num1 - (Num2 * Int(Num1 / Num2)) |
Author: | William [ Sat Sep 23, 2006 8:56 pm ] |
Post subject: | |
pingu wrote: Look, I managed to think up a formula to help you.
If you do: Num1 Mod Num2 It translates to: Num1 - (Num2 * Int(Num1 / Num2)) That I understand. But isnt there something called: what you dont know doesn't hurt you. And to translate that into a coding statement. What you can't code correctly, program around it, if you can't program around it: dig a hole, lay down, and beg for someone to fill the hole. Discussion Closed. I still don't understand fully, but I don't want to. Just so everybody know, Im a "A" student in Mathematics (studying on IB). |
Author: | pingu [ Sat Sep 23, 2006 10:02 pm ] |
Post subject: | |
Would you mind not flipping out on us? This isn't about your grade in math, it's about understanding a very useful operation that you will need for programming in any language. Okay, I'll try once more to explain, but I'll try to jam everything into one post. Don't get intimidated because this operator is text instead of a symbol. It doesn't make much sense because it isn't a function, but an operator. I'm going to use the "@" symbol instead of "Mod" (or "%", because that get's confused with percentage). Got it? So, sample problem number 1 goes like this: 13 @ 5 = ? Now, take it in steps. Find out what "13 / 5" equals. It's 2.6, but there is a nasty decimal at the end. We don't want him so we round down to 2. Now we need to multiply this 2 by the number we divided by. Normally, this would give you the same number you started with (13), but because we rounded down, it won't. 5 * 2 = 10 We now have 10. This is telling us that 10 is the highest number below 13 that can be divided by 5 evenly. Knowing that, we just compare 10 and 13. 13 - 10 = 3 3 is our answer. The remainder of a division problem is the difference between the closest perfect divide (that means that it doesn't have a decimal answer) and the number we started with. I don't know how you learn, so I'm going to try it in terms of fractions. 67 @ 10 = ? Let's divide using the calculator first. 67 / 10 = 6.7 In this method, we don't throw the decimal out yet. I've used "10" to make this much easier to do. Split the number according to the space right before the decimal. So, we have: 6 And .7 We need to figure out what .7 is in terms of something over 10 (If it were 67 @ 8, we'd figure it out over 8 instead. Yhis rule applies for all problems, not just 10 and 8!) x / 10 = .7 Simple algebra here. Multiply both sides by 10 and you get: x = 7 Guess what? The answer is 7. If we were in school and had to divide and find that remainder, 6 would be the answer (67 / 10 rounded down) and 7 would be the remainder (67 @ 10). I hope I kind of help. It's easiest to use mod with 10, because it works perfectly. 85 @ 10 = 5 42 @ 10 = 2 70 @ 10 = 0 But, as I showed... 30 @ 5 = 0 29 @ 5 = 4 28 @ 5 = 3 27 @ 5 = 2 26 @ 5 = 1 25 @ 5 = 0 You'll get used to it. I do it in my head a slightly different way. I round up instead and then subtract the other way, but they both work. |
Author: | Spodi [ Sat Sep 23, 2006 10:31 pm ] |
Post subject: | |
He's just trying to help you, William... Especially if you're taking math, you should know how to do this. Remainders are something you deal with when you first learn division in elementary school. If you dont know it now, you are going to be screwed later on if you ever need to use it again. And grades only show how much you study what is being taught at the time, not how good you are at the subject. |
Author: | William [ Thu Feb 15, 2007 11:26 am ] |
Post subject: | |
hehe.. Just read the first posts and understood it now Not sure why I didn't get this before. |
Page 2 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |