dastonecutters
Member
- Joined
- May 27, 2004
- Messages
- 107
- Gender
- Male
- HSC
- 2004
what is Multiplication and division of Binary.... i got told about it the other day but the person who told me about it coupldnt remember how to do it
We'd have to look at things on the processor level to answer this question. As you probably already know, CPUs have instructions sets (op codes) that instruct it what to do with data.dastonecutters said:and what is it used for...
Yep... basically the CPU isnt that smart, the realy main thing it can really do is ADD, nothing but add, subtraction and multiplication and division are all derived from the function of adding, subtraction is repeated addition of a negative binary number, multiplication is repeated addition and division is repeated subtraction... so basically the CPU isnt that smart... but fast...sunny said:We'd have to look at things on the processor level to answer this question. As you probably already know, CPUs have instructions sets (op codes) that instruct it what to do with data.
Some CPUs have very limited instruction sets as they might not be designed to perform a particular task.
In the case of a single cycle computer, where every instruction executed must finish within one clock cycle, it is not possible to perform complex arithmetic like multiplication and division in one clock cycle. Hence, the CPU itself might not actually be able to multiply and divide. *shock horror*
It is then up to the programmer to devise ways to multiple and divide using only adding, subtracting, ANDing, ORing, etc (and whatever else is avaliable to the programmer)
See if can devise a way of multiplying binary numbers with only adding and some logical operators
There is a much more efficient wayWinston said:multiplication is repeated addition
hmm tell tellsunny said:There is a much more efficient way
1011
101x
---------
1011
00000
101100 +
---------
110111
Binary shift gives you multiplication/division by factors of 2. And to determine how many times to shift you need even more operations.jm1234567890 said:you mean the binary shift?
No that is not true. Most common CPUs you are used to seeing in commericals have multiplication and division hardwired. CPUs used in embedded systems might not.raymes said:todays CPUs typically have multiplication hardwired anyway