1veedo Posted September 12, 2007 Posted September 12, 2007 If you have like say for instance in assembly idiv which gives you how many times it divides and then the remainder you can of course iterate to divide two numbers all the way through (or as far as you want). What I want to do is divide a number by b*c (as opposed to what b * c actually evaluates to). You can divide a by b and then that number by c to get how many times bc goes into a but I can't figure out how to get the remainder. Like if you divide 11 by 6 you can represent it 11/(3*2). 11 / 6 = 1 remainder 5. 11/3 = 3 remainder 2. (a/b = x, r) 3 / 2 = 1 remainder 1. (x/c = x-2, r-2) So we know it divides once but we have two remainders: 1, and 2, and I cannot figure out how to get 5 as your actual remainder. (I'm pretty sure multiplying 3 * 1 + 1 * 2 doesn't work btw on all numbers) edit-- Alright that was kind of dumb. It's obviously a - (bc*x). My problem was in making data smaller I don't want to multiply b times c.
timo Posted September 12, 2007 Posted September 12, 2007 Not really sure what you are trying to achieve, but mayhaps this helps: - I redefine your writing style into something that imho makes a little more sense: 11/6 = 1 remainder 5 --> 11/6 = 1 remainder 5/6 = 1 + 5/6. - Assume the problem a/(b*c). - Define a/b =: x remainder y/b. - => a/(bc) = (x + y/b)/c. - Define x/c =: X remainder Y/c. - => a/(bc) = X + (Y + y/b)/c. Note that and why the 2nd added is <1. - => a/(bc) = X + (Y*b + y) / (bc) meaning a/(bc) = X remainder (Y*b + y). EDIT: Your on my "let him think it through himself for a few minutes"-list now .
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now