answersLogoWhite

0


Best Answer

Let's consider any number, for example a byte of data represented as eight bits. The values that this byte can have are 00000000 through 11111111. The easiest way to find the one's complement is to change the zeros to one and the ones to zeros.

The limits shown above can be represented as 00 through FF in hexadecimal. Let's consider a number AF which is within this boundary. The easiest way to find the one's complement when numbers are represented in hexadecimal form is to subtract the number from (in this case) FF. You will have more F's depending on the length of the number you want to find the one's complement for. If the number consists of three hex digits then you subtract from FFF, if four then from FFFF and so on. Thus with our example of AF, its one's complement would be

FF

AF

---

50

---

If you add 1 to this result you will get the two's complement of the number AF.

Hence the two's complement of AF is (50 + 1) = 51 in hex. Observe that the process of finding one's complement or two's complement of a number are reversible and the original number is obtained. Thus the one's complement of the one's complement of a number gives the original number. The two's complement of the two's complement of a number gives the original number. Lets consider the hex number FF. Its one's complement is 00 and the two's complement is 01.

So far we have talked about two's complement of a number (and in the process the one's complement as well).

It is not possible to explain two's complement representation without understanding hardware implementation on a computing device, namely, a computer. Let's consider a byte machine where you can operate only on single bytes. Thus you can add two bytes, subtract a byte from another and so on.

If two's complement representation of numbers is not implemented on a machine, then the byte can hold values hex 00 through hex FF which would be 0 through 255 in decimal. If 1 is added to a byte containing FF on this machine, the contents of the byte will change to 0 and the overflow bit in the computer will be set to TRUE.

If however, two's complement representation of numbers is implemented on a machine the MSB (most significant bit) in the byte is the sign bit. If it is set then the number is negative and if it is not set then the number is positive. Since one bit of the 8 bits in our byte machine is taken up to represent the sign, only the remaining 7 bits can hold the magnitude of the number. The range of positive number in such a machine is hex 00 through hex 7F which is 0 through 127.

If you add 1 to 7F then the contents of the byte would be hex 80.

Notice that this is a negative number because the MSB is set. But how negative is this number. Since the machine implements two's complement representation of number on this machine, subtract (hex 80) from hex FF and add 1 to get hex 80 which equals 128. So the byte machine which implements two's complement can represent values from -128 through +127. In general if a machine implements 16, 32, or 64 bit architecture, the numbers that they can hold if they implement two's complement are between -(2*n) through and including +(2*n - 1) where n is 16, 32, or 64.

I hope you have a better understanding of the difference between two's complement of a number and its representation (meaning implementation) on a computer.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between the twos complement representation of a number and the twos complement of a number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the 8-bit sign-and-magnitude representation of the decimal number -2?

10


What is the difference between a diploid and a heploid cell?

A diploid cell has a full complement of chromosomes. A haploid cell has half the number of chromosomes as a diploid cell.


Twos complement of a given 3 or more bit binary number of non-zero magnitude is the same the original number if all bits except the?

ANSWER: MSB IS 1 In the 2's complement representation, the 2's complement of a binary number is obtained by first finding the one's complement (flipping all the bits), and then adding 1 to the result. This representation is commonly used to represent signed integers in binary form. Now, if all bits except the sign bit are the same, taking the 2's complement of the binary number will result in the negative of the original number. The sign bit (the leftmost bit) is flipped, changing the sign of the entire number. For example, let's take the 4-bit binary number 1101 The 2's complement would be obtained as follows: Find the one's complement: 0010 Add 1 to the one's complement: 0011


What is the difference between 0 73 and 38.5?

The first number is 0, the additive identity for the set of numbers. The second, 73 is a positive integer or counting number and the third, 38.5 is a decimal representation of a rational number.


What is the difference between a single member district electoral system and a proportional representation electoral system?

In a single member district electoral system, each district elects only one representative, generally based on a plurality or majority vote. In a proportional representation system, seats are allocated to parties based on the proportion of votes they receive, allowing for a more accurate representation of popular vote percentages in the overall composition of the legislative body.


Why 2's complement binary subtraction is preffered over 1's complement binary subtraction?

1


Working of difference engine?

Mechanical implementation of the solution of a difference equation (discrete version of differential equation). It does repeated additions of one value to the next value. With proper analysis and programing it can solve any polynomial equation that fits on the machine. Using a 10s complement signed number representation addition could also simulate subtraction.


What is the difference between the greatest number and the least number?

The difference between the greatest and least number is the range.


What differencess between one's complement and two's complement?

one's complement is a bitwise complement of a binary number. (ie, 1 becomes 0 and 0 becomes 1) A one's complement isn't really used as much as a two's complement. A two's complement is used in a system where the larges bit in a binary number represents a negative number. so the bits for a 4 bit number would have the values of (from right to left): -8, 4, 2, 1 this allows you to represent any number from -8 (1000) to positive 7 (0111) To find the two's complement of a number, you take the one's complement, and then add 1. This significant because if a computer wants to subtract two numbers, it simply takes the two's complement of the second number and adds them together. More significance arises in digital circuits when constructing circuits using only nand/nor gates, as these perform slightly faster than and/or gates.


What is 10.56?

A decimal representation of a rational number which lies between 10 and 11.


What is the greatest negative number which can be stored in a 8-bit register using 2'complement arithmetic?

6


What is the difference between equal and proportional representation?

Equal representation means each region or state is represented by the same number of elected representatives. Proportional representation, on the other hand, means that the number of seats won by a party is proportionate to the received number of votes.