### __ARTICLE:__ Numbers, Arithmetic Operations and Characters

__ARTICLE:__

The logic circuits which operate on the information are the foundation of the machinery and the correct usage of the computers. These are the circuits which use two-valued signals for the representation. The values of the electrical signals are 0 and 1. These are the values which depict the amount of information. They use the signal to define it in the form of bit information. Here, the binary digits represent the bit. For the simple and the natural representation of the number in any of the computer system, we use the binary number in which a string of bits is used. If we need to represent the digits in the form of characters, then a text character is called a character code.

**REPRESENTATION OF NUMBERS**

The vector which is used to represent the list of the numbers contains unsigned integer values. But as we have both the negative as well as the positive numbers to represent, for this we have sign and magnitude, 1’s compliment and 2’s compliment. Read the** branching and the condition code**- one of the most important topics of the system

There is one thing in common in all these three systems. When there is a positive to be represented in any of them, the leftmost bit is 0. And for the negative numbers, it is 1. For the positive values, all the numbers have the same representations in every system. But this is not the case with the negative representations.

**1. Sign and magnitude system-**

Here, if we wish to represent the negative numbers, then we need to change the most significant bit. That means, change the value in the corresponding positive value.

For instance, the bit form of the signed digit, +5 is 0101; then the negated form would be 1101.

**2. 1’s complement-**

Here, to get the negative value, we compliment every bit of the corresponding positive number. That is, if the bit is 0 in the positive form, then it has to be 1 to get its negative value. For example, we have 0011 as the bit representation of the digit-3. To get the negative bit representation, we need to compliment the bits. The resultant of -3 is 1100. Yes, if we need to get the corresponding positive value, then also we can complement the bit. Both the ways in the bit complementation are known as 1’s complement.

The other way of complementing the number to get its corresponding negative or the positive value is by subtracting the number from 2^n-1.

**3. 2’s complement-**

To get the value by the 2’s complement, we would subtract the number from 2^n. In this way, we form the 2’s complement of a number.

If we are given the 1’s complement of a number and asked to reach the 2’s complement, then add 1 to the 1’s complement.

As we have read in the elementary classes in mathematics that 0 has nothing negative and nothing positive about it, nothing -0 and +0. That is there is nothing like -0 and +0 in mathematics, but in the sign and, magnitude and the 1’s complement, these are distinct representations of both these numbers. But, the 2’s complement work as in mathematics. These are the same here.

If we have reached 4 bits, then the value of -8 can be represented in the 2’s complement only. The other systems don’t support it.

Are you getting the value and the concept of the sign and magnitude as the natural system? Yes, it uses the decimal values in natural computations. Whereas, the unnatural system here is the 2’s complement.

**ADDITION OF POSITIVE NUMBERS**

Addition of 0 and 1 is simple, but when we get to the addition of 1 and 1, we need a 2-bit vector. The value of the resultant is 2, and that is why we are using the method of analogous addition. It uses manual computation with the decimal numbers for adding multiple bit numbers.

Start from the low order end of the bit vectors and add the bit pairs. Then propagate the carry and take it towards the high-order end.

**ADDITION AND SUBTRACTION OF SIGNED NUMBERS**

We have been talking about the positive and the representation of the negative number. The big and the most prominent difference in the three systems is the way they represent the negative numbers.

The best system for the addition and the subtraction of bit numbers is the 2’s complement, and the most awkward is the sign and magnitude. Here are some rules in which the addition and the subtraction of the n-bit signed numbers take place in representation system of 2’s complement.

**1. For adding two numbers-** From MSB position, ignore the signals which come out as carrying and add the n-bit representations. Here MSB is the most significant bit. If you need to check the credibility and the authenticity of the answer, then check whether it is in the range of the -2^(n-1) and +2(^n-1)-1.

**2. For the subtraction of two numbers-** To get the subtraction result, make the second numbers’ 2’s complement and then add it to the first number. The result which you would get by doing this will be algebraically correct only if it lies in the range from -2^(n-1) and +2(^n-1)-1. You can check through this.

In the 2’s complement, we represent a number using some bits, but the number of bits used here must be larger than the given size of the numbers.

**For positive numbers**- We can do this by adding 0s to the left of the digits.**For negative numbers**- In this, the leftmost bit is always the sign bit. It is 1. We can replicate the sign bit for a longer number with the same value. Replicating takes place in the left of the digit and can be done for any number of times.

**SIGN EXTENSION**

For the representation of a signed number, we form a large number of bits in the 2’s complement. After this, the sign bit is repeated for as many times as desired.

The addition and the subtraction done in the 2’s complement are used in the computers of the modern day. It is the system better than the 1’s complement and has taken all the leads. The major difficulty is that the concept of complementation is east, but there is no 100% accuracy all the times. The result can be corrected by the addition of 1 in the wrong result. For checking the result, we need to study the mod 16 circle. It is a conditional concept and can make the process of addition and subtraction very convenient.