answersLogoWhite

0


Best Answer

1

User Avatar

Veda Glover

Lvl 10
3y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

16y ago

That is just how 2's complement works. Put another way, you are asking:

Why, in two's complement representation, is the arithmetic negation of a number represented by flipping all the bits in the number and adding one?

One way to think about the answer, is that otherwise, there would be two different representations of 0; one for 0 (all 0 bits) and one for -0 (all 1 bits). In order that there will be only one representation of 0, we add one to the all-1-bits representation of -0, and because that 1 overflows the result, we end up with all 0 bits again.

Another advantage of this representation is that when you add a number and its binary negation, you get all 1 bits. If you add one to that, you end up with 0, which means that x + (-x) = 0.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

They are different things, don't interchange them.

Example in C:

int x= 19;

printf ("1's complement of %d (%xh) is %d (%xH)\n", x, x, ~x, ~x);

printf ("2's complement of %d (%xh) is %d (%xH)\n", x, x, -x, -x);

result:

1's complement of 19 (13h) is -20 (ffffffecH)

2's complement of 19 (13h) is -19 (ffffffedH)

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

One's and two's complement are different ways of representing integer values. The one's complement of any value simply inverts all the bits in the value. The two's complement does the same but also adds one to the inverted value.

One's complement was originally used to negate a signed value, however its usage for this purpose is not widespread. To understand why, take the decimal value 7 which is represented by 00000111 in binary. The one's complement is therefore 11111000. Although this physically represents decimal 248, in signed notation the most significant bit denotes the sign. Thus 11111000 signifies -7 in one's complement; in other words the complete inversion of +7. Since the most significant bit denotes the sign, the range of signed 8-bit values is -127 to +127. However, the one's complement of 00000000 is 11111111 which is erroneous; the value zero is neither positive nor negative and yet one's complement treats +0 and -0 as begin two separate values.

Two's complement resolves the problem by adding one to the one's complement. Taking the example 7 once more, 00000111 becomes 11111000 + 1, which is 11111001 or -7 in two's complement notation. To invert the sign again, 11111001 becomes 00000110 + 1 which is 00000111, the original value. More importantly, the two's complement of 00000000 is 11111111 + 1 which is 00000000. Thus we replace the two +/- zero values with a single unsigned zero value, and the range of possible signed values increases by one: from -128 to +127.

Although it may seem more logical to simply switch the most-significant bit alone in order to switch the sign, this is no better than one's complement because 10000000 would represent -0. By completely inverting and adding one we actually simplify the logic of signed values by counting upwards from 10000000 (-128) to 11111111 (-1), followed by 00000000 (zero), followed by 00000001 (+1) to 01111111 (+127).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why 2's complement binary subtraction is preffered over 1's complement?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Are binary strings used in Java?

No if there was then java wouldn't have over 4 billion down loads


What is unsigned data types in turbo c?

The same as an unsigned type in any other implementation of C. An unsigned type is an integer that is guaranteed positive. Normally, the most-significant bit of an integer denotes the sign (positive or negative). Unsigned types use this bit to denote value, effectively doubling the range of positive values over that of the signed equivalent. For instance, a signed char has a guaranteed range of -127 to +127 while an unsigned char has a guaranteed range of 0 to 255. Note that a signed char typically has a valid range of -128 to +127, however this is only true on systems that utilise twos-complement notation. Those that use the older ones-complement notation have two representations for the value zero (one positive, one negative). Ones-complement simply inverts all the bits of a value to switch the sign of a value, whereas twos-complement adds the value 1 after inverting all the bits. The value zero is denoted as 00000000 in binary. Inverting the bits creates 11111111, which is minus zero on a ones-complement system and -1 on a twos-complement system. -1 + 1 is 0, hence we add 1 on a twos-complement system.


What is the advantages of binary digits over the decimal?

Computers do not understand decimal notation. All information (both instructions and data) must be converted to a binary representation before the machine can understand it. We use the symbols 0 and 1 (binary notation) but the machine has a variety of physical representations it can use to encode binary data, including transistors, flux transitions, on/off switches and so on.


What is the difference between decimal and binary odometer?

ticking over and getting a new no. like do the clock or some type of speedometer...


Application of binary tree in data structure?

1) the complexity of insertion,deletion and searching operation is depend on the height of the tree. i.e. if height is n(for skew binary tree) then complexity is O(n) . 2) difficult to get the sorted list from the binary tree.which is easy for BST.

Related questions

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

1


Why was cuniform preffered over picture writing?

it was quicker .


Why is red led preffered over other leds?

red led is rare and from WW2


Why is HDI preffered over the traditional gross product?

To see how other countries are doing.


Can multiplication be distributive over subtraction?

Multiplication can be the first step when using the distributive property with subtraction. The distributive law of multiplication over subtraction is that the difference of the subtraction problem and then multiply, or multiply each individual products and then find the difference.


Why are hollow electric poles preffered over solid poles?

They both weigh and cost less.


What is the distibutive property mean?

The distributive property is a property that relates to two binary operations and operates over a set.According to the distributive property of multiplication over division, if a, b and c are three elements of a set S, thena*(b + c) = a*b+a*cMultiplication is also distributive over subtraction.


Why is mutton preffered over beef in Pakistan?

Because beef is expensive and not good in taste and it even stinks


Is multiplication distributive over subtraction?

yes


What is the distributive property of 2k plus 10?

2k + 10 is an expression. The distributive property is a property of one binary operation (typically multiplication, or right-division) over another (addition or subtraction) for elements of a set (numbers); not a property of expressions.


What does it mean that multiplication distributes over addition and subtraction?

It means that A*(B+C) = A*B + A*C and similarly for subtraction.


Why is ce amplifiers preffered over cb amplifiers?

yes because efficiency and application specify is more improve