What is an arithmetic shift?

arithmetic shift is a way to multiply or dividing numbers. Arithmetic shifts are usually carried out on binary numbers. However, the concept is applicable to any numbering system. When 250 is arithmetically shifted to the left, the resulting number is 2500, which is 250 multiplied by ten. When 250 is represented using 4 digits as 0250, the right is arithmetic, the resulting number is 0025, which is 250 divided by ten. It is therefore more correct to say that the arithmetic shift is a way to multiply or dividing numbers by the base of the numeric scheme.

binary numbers have 2 as a base; They are represented using 0 and 1s and can be signed or unsigned. In the arithmetic shift, the numbers are moved by one space to the left, with zero located to the right. In the arithmetic right shift, the numbers are shifted by one space to the right, keeping the left to the left to the left. In general, the shift for "n" spaces can be.

In unsigned binary numbers, each position is 2, so binary 1 is decimal 1, binary 10 is decimal 2, binary 100 is decimal 4, and so on. So 0110 is decimal 6. When the arithmetic shift on the left is done, the resulting number is 1100, which is decimal 12. When the arithmetic right shift is performed, the resulting number is 0011, the decimal 3.

Since the numbers can be both positive and negative, signed binary numbers are used, where the bit left is 0 for a positive number or zero and 1 for a negative number. For four -bit numbers, 0111, which is decimal 7, is the largest positive number. The diagram most commonly used for negative numbers has 1111 as a decimal -1 and it goes up to 1000, which is decimal -8.

For example, the arithmetic shift to the left to 1101, which is decimal -3, results in 1010, which is decimal -6. The arithmetic right shift to 1010, which is decimal -6, results in 1101, which is decimal -3. Note that the bit on the left is detained.

arithmetic shift nE always corresponds to multiplication and division for each number in the number. There are restrictions at both ends of the number of schemes. For example, left shift 0111, decimal 7, gives decimal -2 and right shift 1111, decimal -1, gives decimal -1.

Arithmetic shift has its own simplicity and the shift is much faster than normal multiplication and division. Computers therefore support this operation using a relatively simple mechanism called Shift Unit or Shift Register. Ingredient programmers use this operation if the above restrictions avoid or take care of them.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?