Its a computer architecture class In week 2 we learned about
Solution
Computers use binary numbers because they have circuits which are either on or off, which gives them two states to work from to make calculations and run processes. The two-digit, or base 2, number system is much easier for thecomputer to process with the circuits they have.
Computer is used to optimise memory and save space and faster caluculations.
Binary number system is not complicated. Once you learn how number systems work it’s very easy to conver from from decimal to binary:--
There are several method to represents binary negative numbers:
Signed Magnitude
This is the simplest method: Use the leftmost digit as a sign indication, and treat the remaining bits as if they represented an unsigned integer. The convention is that if the leftmost digit (also called the most significant digit or most significant bit) is 0 the number is positive, if it’s 1 the number is negative. e.g:
For a 32 bit system an unsigned INT can go up to 4,294,967,296 (which is 2^32 – 1). You need to subtract one because the result of 2^32 starts from 1, while the first binary representation is 0
One’s Complement:
To obtain one’s complement simply need to flip all the bits. Suppose we are working with unsigned integers.
Decimal 10 is represented as: 00001010
It’s one complement would be: 11110101
Since we are using 8 bits here the maximum number represented is 255 (2^32 – 1). So the complement of 10 will be 245
If we add the number and it’s complement the result should be 1s on all bits.
Two’s Complement:The Two’s Complement of a binary number is basically another number which, when added to the original, will make all bits become zeroes. You find a two’s complement by first finding the one’s complement, and then by adding 1 to it
For example, let’s find the two’s complement of 12. The binary representation of 12 is 00001100. It’s one’s complement is 11110011. Add one to that and we have its two’s complement.
Now if we add 12 with its two’s complement we should get all 0s.
Once more we’ll use the most significant bit (i.e., the leftmost one) to represent the sign of the number. Let’s suppose we want to represent -5. First of find its one’s complement, which is 11111010, and then we add 1 to it. So -5 is represented as 11111011 in binary under the two’s complement system.
Now let’s add 12 with -5 to see if we’ll have the same problem that we had when using the one’s complement system:
00001100 (decimal 12)
Addition and Subtraction Using One’s Complement
One of the main advantages of One’s Complement is in the addition and subtraction of two binary numbers. In mathematics, subtraction can be implemented in a variety of different ways as A – B, is the same as saying A + (-B) or -B + A etc. Therefore, the complication of subtracting two binary numbers can be performed by simply using addition.
We saw in the Binary Adder that binary addition follows the same rules as for the normal addition except that in binary there are only two bits (digits) and the largest digit is a “1”, (just as “9” is the largest decimal digit) thus the possible combinations for binary addition are as follows:
When the two numbers to be added are both positive, the sum A + B, they can be added together by means of the direct sum (including the number and bit sign), because when single bits are added together, “0 + 0”, “0 + 1”, or “1 + 0” results in a sum of “0” or “1”. This is because when the two bits we want to be added together are odd (“0” + “1” or “1 + 0”), the result is “1”. Likewise when the two bits to be added together are even (“0 + 0” or “1 + 1”) the result is “0” until you get to “1 + 1” then the sum is equal to “0” plus a carry “1”. Let’s look at a simple example.
Subtraction of Two Binary Numbers
An 8-bit digital system is required to subtract the following two numbers 115 and 27 from each other using one’s complement. So in decimal this would be: 115 – 27 = 88.
First we need to convert the two decimal numbers into binary and make sure that each number has the same number of bits by adding leading zero’s to produce an 8-bit number (byte). Therefore:
11510 in binary is: 011100112
2710 in binary is: 000110112
Now we need to find the complement of the second binary number, (00011011) while leaving the first number (01110011) unchanged. So by changing all the 1’s to 0’s and 0’s to 1’s, the one’s complement of 00011011 is therefore equal to 11100100.
Adding the first number and the complement of the second number gives:
Since the digital system is to work with 8-bits, only the first eight digits are used to provide the answer to the sum, and we simply ignore the last bit (bit 9). This bit is call an “overflow” bit. Overflow occurs when the sum of the most significant (left-most) column produces a carry forward. This overflow or carry bit can be ignored completely or passed to the next digital section for use in its calculations. Overflow indicates that the answer is positive. If there is no overflow then the answer is negative.
 The 8-bit result from above is: 01010111 (the overflow “1” cancels out) and to convert it back from a one’s complement answer to the real answer we now have to add “1” to the one’s complement result, therefore:
So the result of subtracting 27 ( 000110112 ) from 115 ( 011100112 ) using 1’s complement in binary gives the answer of: 010110002 or (64 + 16 + 8) = 8810 in decimal.
Then we can see that signed or unsigned binary numbers can be subtracted from each other using One’s Complement and the process of addition. Binary adders such as the TTL 74LS83 or 74LS283 can be used to add or subtract two 4-bit signed binary numbers or cascaded together to produce 8-bit adders complete with carry-out.
| 0 | 0 | 1 | 1 | |
| + 0 | + 1 | + 0 | + 1 | |
| 0 | 1 | 1 | 1 0 | ( 0 plus a carry 1 ) | 


