On Tue, Jan 18, 2005 at 03:59:50PM -0800, Globe Trotter wrote: .... > My question is: how does a computer actually do it? When we are > dividing a number by a multiple of two, for example 5 = 101 divided > by 2 = 10, then all we do is shift the bit by the number of digits > after the leading 1 in 2. So, 101 divided by 10 means drop the last > 1 in the 101 so we get 10. .... > What happens if we divide 5= 101 by 3= 11? Anything similar? .... > I just was curious, and I thought entrepreneurial Fedora users would > be the best to ask! You are almost asking a hardware question..... The older computer texts cover this. Most modern ones just gloss over the various choices because it is no longer interesting for most students to look at it. Sort of like slide rule class.... Look at 2's compliment arithmetic. Most hardware is designed in a Very High level Description Language. Read more about it in: VHDL for Programmable Logic, Kevin Skahill, 1996 (Cypress Semiconductor) One OK reference on hardware is Computer Design and Architecture, Sajjan G. Shiva, 1985 (see chapter 6 section 10). Shiva reminds me that off the shelf ALU (arithmetic logic unit) were once key building blocks. Look for a data sheet on parts like the Texas Instruments 74181 and SBP 9708. Also look for data sheets and books on the AMD 29K bit slice logic family. Ponder why these parts were used in old video games like Marble Madness. If you really want to grok how a processor might be built look for the data book for the MC14500B Industrial Control Unit, Handbook. The Motorola MC14500B is a 'single bit processor'. The handbook gives some examples that let a designer add additional logic blocks and data paths that might include things like an ALU and more. If your brain has yet to explode look at "Computer Architecture A Quantitative Approach, 2nd Ed, Hennessy and Paterson, 1996. (+$75.00). For goodness sake, download all the information you can find on the specific processor in your system. AMD, Intel etc. all have extensive documentation to download. Some of it can be very specific on how various instructions work. For grins look for the OLD, Motorola, Intel, AMD processor data books. Often the old books contained extensive almost tutorial documentation on the way the part worked. The early discussions in Intel books on accuracy and precision with regard to the wide 80 bit ALU registers used to compute 64 bit IEEE arithmetic are interesting. It was and is possible to get slightly different results when the internal registers are used to hold intermediate results in contrast to stack or memory saves. Extra point question... Does the recent 2.6.10 kernel save all 80 bits or just the 64 bit content of the floating point registers on Intel processors that have the wide ALU registers when it does a context switch/ interrupt handler? Why might we care? -- T o m M i t c h e l l spam unwanted email. SPAM, good eats, and a trademark of Hormel Foods.