answersLogoWhite

0


Best Answer

The question has to do with the way how whole numbers are to be represented in binary notation, and in particular how negative numbers should be coded.

In the above question, the number has 8 binary digits (bits), allowing exactly 256 different combinations to be used, from 00000000 to 11111111. If we consider only positive numbers, this would allow for all numbers from 0 (naturally represented by 00000000) to and inclusively 255 (represented by 11111111).

Now if you want to take negative numbers into account, there is a problem. The most obvious solution is to spare the first bit as a sign indicator, thus leaving the 7 last bits to represent the numbers. This way was chosen in the early days of FORTRAN, one of the first popular programming languages. This simple way to represent negative numbers has for it the equally simple way to compute the negative of a given number: just invert the first bit!. Hence, the number 3, for example, represented as (00000011) will give (10000011) for -3 (we have just toggled the first bit).

This simple way has a drawback: the negative of 0 (00000000) is now (10000000), known as -0 by FORTRANists. But, as everyone knows, except perhaps the thermometer indicator in you car, which ostensibly uses this notation, -0 and +0 are the same number, at least according to arithmetic rules teached in the primary school.

But if you consider their binary representations, they differ. Hence, in some cases, two arithmetical results everyone consider equal can be judged different by a FORTRAN program, leading to strange results (this is clearly a bug that is very difficult to pinpoint). Moreover, this strange behavior will disappear if you reorder your computations, thus violating the commutativity rules everyone expects from whole number arithmetic

This way of representing negative numbers is known as the one's complement notation. Hence, the 1's complement to the number mentioned in the question is 01010001, corresponding to 81 in decimal notation.

To solve the above -0 problem, modern computers and programming languages have adopted another representation, the so-called 2's complement. The idea is to sacrifice the simple symmetry of the one's complement notation by specifying that the computation of the negative of a given number must be done by inverting each bit (inclusively the sign bit) and adding 1 to the result.

For example, if you consider the number 3 (00000011), its negative, or 2's complement, is (11111101) (all bits inverted and 1 added (possibly leading to carries that must be handled properly). If you take 0 (00000000), its negative would be (11111111 + 00000001), giving (00000000) plus an overflow carry on the first bit that is ignored, but the net effect is that the negative of 0 is still 0, as everyone would expect.

The glitch in the above computation is that there now exists a negative number without positive counterpart Consider 10000000. This should be interpreted as -128, because it is -127 (10000001) from which 1 has been subtracted. But +128 cannot be represented, nor computed. If you apply the above negation algorithm to -128, you obtain again 10000000, that is -128 itself. Looks like the trick that solves the negative of 0 problem just generates a new problem at the other end of the number spectrum.

On the other end, if you consider computer arithmetic in general, you should always take overflow problems into account, because computer numbers have only a limited precision or magnitude, determined by the number of bits you are using to represent your numbers. The above problem is exactly the same if you extend your arithmetic representation to 16, 32 or even 64 bits. If you add two big numbers and the result is too large for your representation, then you should raise an overflow exception.

Most computers just don't do that for efficiency reasons, because checking for the overflow may be as costly as the computation itself, and nobody is willing to sacrifice 50% of his computing power just to check for exceptions that nearly never arrive (but just nearly, not absolutely never). Hence it is the programmer's responsibility to ensure that his computations remain in the allowed arithmetic range.

Some strange bugs may naturally arise if your computer considers -128 and +128 to be the same number, as will be the case with the 2's complement notation on an 8 bits computer, but this is considered less harmful (not harmless!) than considering +0 and -0 as different numbers.

With modern 32 bits computers, the problem arises only with (approximately) +2 billions and -2 billions, hence the arithmetic range is considered big enough to neglect the problem in everyday cases.

So modern binary computers all use the 2's complement notation. Coming back to the original question, the 2's complement of the given number will be 01010010, corresponding to 82 in decimal notation

Summary

1's complement: 10101110 -> 01010001 (81 in decimal)

2's complement: 10101110 -> 01010010 (82 in decimal)

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

2's complement is very simple. 1st take 1's complement of the number and than add 1 to it.

No= 010100110

1's= 101011001

+1

2's=101011010.

so 2's complement is 101011010.

for programming visit Codes Mesh.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: 1's and 2's complement of the following binary numbers 10101110?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Show that 8's complement octal and 2's complement binary are exactly equivalent.?

trivial.


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 the binary complement 8 bit representation for negative 19?

8-bit 2s complement representation of -19 is 11101101 For 1s complement invert all the bits. For 2s complement add 1 to the 1s complement: With 8-bits: 19 � 0001 0011 1s � 1110 1100 2s � 1110 1100 + 1 = 1110 1101


How is the two's complement representation used?

The "twos complement" is that marvelous manipulation of bits in computer binary code that allows the computer to subtact by adding. It would be difficult to explain the whole picture, but computers can really do nothing but add. So the natural question is, how do they then calculate differences? Two's complement is the answer.


What is incomplete binary tree?

Incomplete Binary Tree is a type of binary tree where we do not apply the following formula: 1. The Maximum number of nodes in a level is 2

Related questions

In the bionary numbering system what does 10101110 represent in the decimal numbering system?

10101110 = 174 = AE = ® binary = decimal = HEX = ASCII


Convert the following decimal numbers into their equivalent binary numbers and then convert the resulting binary numbers back into the decimal numbers a. 6401 b. 1010110?

a) 6401 in Binary is 1100100000001b) 1010110 in decimal is 86


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 has the author James Edward Simpson written?

James Edward Simpson has written: 'An array multiplier for twos-complement binary numbers' -- subject(s): Binary system (Mathematics)


What is the result of following equation in binary format 6 - 3?

3


Which of the fallowing decimal numbers corresponds to the binary number 0000111?

The following is the answer!


Which of the following binary numbers is the equivalent of the decimal number 206?

206 = 11001110


Show that 8's complement octal and 2's complement binary are exactly equivalent.?

trivial.


What is the sum of the binary numbers?

The sum of binary numbers is also a binary number.


What is the significance of 26 complement in binary arithmetic?

26 decimal is 11010 binary. Its ones complement (in 5 bits) is 00101, which is 5 decimal. In 16 bits, its ones complement is 1111111111100101 which is -27 when interpreted as a signed decimal, and 65509 as an unsigned decimal.


What are binery numbers?

Binary numbers belong to Binary number system. Binary System consists of only 2 digits (known as bits) 0 & 1. Any no. from decimal number system can be converted to binary number system. Binary numbers are widely used in design of various digital gadgets & computers. Following are some decimal no.s converted into binary numbers. Decimal number Binary number 0 0 1 1 2 10 3 11 4 100 5 101 6 110


What is the two's complement form of -25 using 8 bits?

25 in Binary is 00011001, the one's complement of this is 11100110 and to find the two's complement add 1 to the one's complement as follows 11100110 00000001 ________ 11100111 ________