answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Why 2's complement representation is preferred for negative number over 1's complement representation?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

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 8-bit sign-and-magnitude representation of the decimal number -2?

10


What type of number is 47?

It is a decimal representation of a negative rational number. It also belongs to any superset that contains the set of negative rational numbers.


How can you represent a negative integer in a computer system?

There are many different ways this can be done using binary form:signed magnitude, one bit is the sign (i.e. 0=+, 1=-) and the other bits are the magnitude of the number (this is analogous to how we write negative integers on paper)ones complement, invert every bit of the magnitude of a number to get its negative formtwos complement, invert every bit of the magnitude of a number then add one to get its negative form (most computers now use this form as the arithmetic circuits to do calculations in this form are simpler and thus less expensive than for the other two.There are also corresponding ways this can be done using decimal forms (e.g. BCD, 2 of 5, excess-3)signed magnitude, one bit or digit is the sign (i.e. 0=+, 9=-) and the other digits are the magnitude of the number (this is analogous to how we write negative integers on paper)nines complement, subtract every digit of the magnitude of the number from 9 to get its negative formtens complement, subtract every digit of the magnitude of the number from 9 then add one to get its negative form


What is the two's compliment?

The 2's complement of a number in n bits is that number when added to the original number results in 0 in n bits. It is used to represent negative numbers so that with n bits you have 2ⁿ⁻¹ each of positive and negative numbers - the top bit is used to specify if the number is negative and if set, the number is stored in 2's complement of the positive number. As a result of this, when adding or subtracting positive and negative numbers, there is no need to worry about the sign as it is handled automatically. To convert a binary number to its 2's complement invert all the bits and add 1 (this is the same as subtracting it from 2 to the power of one more than the number of bits used to store the number) eg in 8 bits, the 2's complement of 42 (0x2A = 0010 1010) is: Invert all the bits: 0010 1010 → 1101 0101 add 1: 1101 0101 + 1 = 1101 0110 (0xD6) → the 2's complement of 42 in 8 bits is 214 (= -42) Note: 42 + 214 = 256 = 1 0000 0000 in binary which has the bottom 8 bits 0. When doing arithmetic with signed numbers, there is usually an overflow flag (V) in the processor which is set if the operation results in a carry from the top-1 bit to the top bit. eg in 8 bits when using signed numbers 42 (0010 1010) + 100 (0110 0100) = 142 (1000 1110) but as it has the top bit set it represents a negative number (142: 1000 1110 → 0111 0001 + 1 = 0111 0010 = -114) - to indicate that the number (could) represent a negative number not a positive number the processor may set the overflow flag. The maximum positive number in 8 bits is 127 (0111 1111), the maximum negative number is 1000 0000 → 0111 1111 + 1 = 1000 0000 = -128; ie the range of possible numbers when using 8 bits to represent a signed number is -128 to +127

Related questions

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

1


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 2's complement of -24?

26


What is the difference between the twos complement representation of a number and the twos complement of a number?

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.


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

10


How to subtract the hexadecimal number 1245 from D257 using two's complement addition method?

You take 1245 and form the two's complement of it then add it to D257. The two's complement of a number is defined as the 1's complement + 1. In signed two's complement arithmetic, the most significant bit is the "sign" bit. 1 indicates a negative number and 0 indicates a positive number. To find the magnitude of a negative number, take it's two's complement (ignoring carry bits). To get the two's complement of 1245, take the 1's complement of 1245 and add 1. In binary 1245 is 0001001001000101. The one's complement is 1110110110111010 (in hex that's EDBA) . Adding 1 to this will give you the two's complement. That is EDBA+0001 (ignore the carry if any), is EDBB. Now you add EDBB to D257 and ignore any carry, so that will be 1C012 (throw away the carry bit), C012. C012 is a negative number (the sign bit, the most significant bit, is 1). To find its magnitude, apply the two's complement algorithm above, and you'll find it to be -16365. Note: D257 is a negative number, and you're subracting a positive number, so you're going to end up with another negative number, i.e. adding the two's complement of a number is the same thing as subtracting the number. You can check your result by doing the math in decimal to see if it adds up. D257 in decimal = -11688 (you apply the two's complement to the number to find the magnitude, and the sign is negative because the sign bit, the most signficant bit is 1). 1245 in decimal = 4677. -11688-4677 = -16365 (which in hex signed two's complement is C012).


What type of number is 47?

It is a decimal representation of a negative rational number. It also belongs to any superset that contains the set of negative rational numbers.


What is the largest positive and largest negative decimal number that can be expressed as an 8-bit 2's complement binary number?

6


Difference in 1's and 2's Complement?

1's Complement, has two different codes for the number 0 (+0 & -0), negative numbers are the simple binary complement of positive numbers, is symmetrical (same number of negative and positive numbers can be represented), adder/subtractor must implement wraparound carry from MSB to LSB to get correct answer2's Complement, has only one code for the number 0 (+0), negative numbers are 1 greater than the simple binary complement of positive numbers, is asymmetrical (one extra negative number than positive numbers), adder/subtractor is identical to a simple unsigned binary adder/subtractor without any special carry circuits needed


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

6


How is 3 a complement of 7?

For example in the decimal (base 10) system the complement of 7 is 3 (i.e 7 + 3 = 10)the complement of 8 is 2etc.the complement of 99 is 01 (i.e 99 + 1 = 100)the complement of 78 is 22 (not 32)the complement of 2000 is 8000etc. It is a curious fact that a computer subtracts using addition.First a method known as 2's Complement is used to create a negative representation of the number to be subtracted..Then subtraction is a matter of adding the negative number to the number from which it is being subtracted. (!)But before we look at 2's complement, let's use a familiar number system to understand the concept of complements. Complements The complement of a number is the number which when added to the original will make it equal to a multiple of the base number system.The complement of a number can be used as a representation of that number as a negative - moreover, as a positive number representing a negative! It is really a bit of a trick which we can use to make subtraction easier for machines.For example in the decimal (base 10) system the complement of 7 is 3 (i.e 7 + 3 = 10)the complement of 8 is 2etc.the complement of 99 is 01 (i.e 99 + 1 = 100)the complement of 78 is 22 (not 32)the complement of 2000 is 8000etc.Consider that: -1 = +9 -10 -99 =+1 -100 -7 = +3 -10 -78 =+22 -100 -56 = +44 -100 -200 = +800 -1000If we can 'lose' the multiple of 10 which has been used to create the complement, then we can subtract using addition - based on the principle that :subtraction is mathematically the same as adding the negative of the number we want to take away.The complement method of subtraction uses the complement as a negative representation of the number to be subtracted.For example in the decimal (base 10) system:7 minus 3 is mathematically the same as 7 plus (minus 3)i.e: 7 - 3 = 4 is the same as 7 + (-3) = 43 minus 3 is mathematically the same as 3 plus (minus 3)i.e: 3 - 3 = 0 is the same as 3 + (-3) = 0the complement of 3 is 77 minus 3 is the same as 7 plus the complement of 3so: 7 - 3 becomes 7 + 7 which =14If we remove the left-most 'additional' digit, 7 - 3 = 4 is the same as 7 + 7 = (1)4We discard additional left-most digits.We can see them as being additional because conceptually a new left-most column is added.In the above example '7 minus 3' is a single column subtraction and the answer will only require a single column.Consider that if we are using a machine with cogs, or a computer with a fixed number of bits, it is easy to 'lose' the leftmost digit. In the following examples, all the results when we use a complement for subtraction have an additional 1 in the leftmost column - which we discard when looking at the answer. Note however that the '1's also flag the result is a positive number.1)7-70 1a)7+31 0 !!! 2)99-7821 2a)99+221 21 !!! 3)2000-19990001 3a)2000+80011 0001 !!! 4)100- 793 4a)100+ 3103 !!! 5)100-007093 5a)100+9931 093 In example 4a, the answer is incorrect! but as soon as we realise that in this system: the number we are subtracting must have the same number of digits as the number from which we are subtracting, then we can obtain a correct result. Study the examples 5) and 5a) above. Can you see why the complement of 007 is 993? In the following examples, note that there is no 'discard' column - I have put a '0' to denote this.Can you see why the answers appear incorrect? and what needs to be done?6)1-2-1 6a)1+80 9 !!! 7)7-17-10 7a)07+830 90 !!! 8)11-78-67 8a)11+220 33 !!! 9)2000-2999- 999 9a)2000+70010 9001 All the results in the sums above should be negative. The results in the sums using complements are negative but are still shown as complements (i.e as positive representations of negative numbers). If we were using a machine to do these calculations we could set it to note that there is no discarded leftmost digit and that in order to return a 'true' negative number, the result needs to be replaced by its complement with a minus sign in front.So, in the examples above, '9' is the complement form of '-1', '33' = '-67', etc.Copyright: Tony Drewry


What is the greatest negative number which can be stored in a computer that has 8-bit word length and uses 2's complement arithmetic?

-128