writerveggieastroprof My Journal |
||
:: HOME :: GET EMAIL UPDATES :: DISCLAIMER :: CRE-W MEMBERS! CLICK HERE FIRST! :: My Writing Group :: From Lawyer to Writer :: The Kikay Queen :: Artis-Tick :: Culture Clash-Rooms :: Solo Adventures of One of the Magnificent Five :: Friendly to Pets and the Environment :: (Big) Mac In the Land of Hamburg :: 'Zelle Working for 'Tel :: I'm Part of Blogwise :: Blogarama Links Me :: | ||
Mood: Spoonfeeding Read/Post Comments (0) |
2007-06-30 12:14 AM The Programming Bugs Are in the Details Student "edition" found at {csi dot journalspace dot com}.
Maybe I shouldn't have started this blog now, not with everything that's been going on. In my Computer Circuit Fundamentals class, the students were still working on the two digit by two digit multiplication, for which they needed the division command to be able to get the digit in the thousands place, the hundreds place, the tens place and the ones place, since 9801 is the maximum possible product (from the square of the largest two-digit number, 99). We already had a practice problem where the students just assigned values and displayed the integer quotient and integer remainder, so they already had an idea how the command works. Still they were getting the divide overflow error. This, apparently, is because they still hadn't gotten the hang of when to use an 8-to-16 bit operation and when to use a 16-32 bit one. Two digits can fit in an 8 bit register, so that is what they use for their multiplication, with the product placed in a 16 bit register. The problem is that when they divide by 1000 to get the thousands place, 1000 can only fit in a 16 bit register as well. So they are effectively trying to divide a 16 bit register by another 16 bit register, which the compiler won't allow from our discussion. So I had to give them the step by step procedure of how to get each digit. First, they could either use a 16 by 16 bit multiplication to place the result in a 32 bit register, or they could use 8 by 8 bit multiplication and put the result in a 32 bit register from the set 16 bit assignment, which just means assigning the higher 16 bits of the larger register to zero. Next, when they divide by 1000, the result will be in two 16 bit registers. Since they're going to divide by 100 next, which could fit in an 8-bit register, the answer would be in another 8 bit register. 999, which is the largest 3 digit number they could have after the first division operation, can fit in a 16 bit register (whose range is from 0 to 65535, while for 8 bits its 0 to 255). The remainder of the second division is 2 digits, so it can fit in an 8 bit register, but they have to divide by another 8 bit register, so they have to place the remainder in a 16 bit register before the operation can be done without error. So in the process, they also have to learn who to make 8 bit registers to 16 bit, 16 bit to 32 bit, and vice versa. Session 1693 doesn't listen to the lecture or copy down notes, so they are always asking the teacher to repeat what the commands do. Class dismissed. Read/Post Comments (0) Previous Entry :: Next Entry Back to Top |
© 2001-2010 JournalScape.com. All rights reserved. All content rights reserved by the author. custsupport@journalscape.com |