Arithmetic movement in binary math

Thread Starter

dudeperfect

Joined Apr 15, 2015
4
Good day,
I need to do some math with arithmetic movements in binary codes. I have one question, if for example I have a number that is represented as inverted code, for example:
+26 is 00011010
-26 is 11100101

What I need to do is to make a scheme, that does Arithmetic movement to left by one. So if I have a negative number represented in inverted code, how can I describe the new number with arithmetic movement to left by one?

If I have X1X2X3X4X5 then when I do that movement, it becomes X2X3X4X5X1 ? (I mean the first bit goes to last one? Cause I know if number is positive, then we need to write 0, if not, then 1, so I guess it depends on the first bit of number, am I wrong?)
 

Papabravo

Joined Feb 24, 2006
21,159
I have no idea what you are talking about.
If you want to do arithmetic in 1's complement notation you do an end around carry. Also you need to handle +0 and -0
I can't see any valid reason for using movement to do arithmetic, unless it is bitwise multiplication and division. In those cases we use shifting and not rotation.
 
Last edited:

Thread Starter

dudeperfect

Joined Apr 15, 2015
4
I have no idea what you are talking about.
If you want to do arithmetic in 1's complement notation you do an end around carry. Also you need to handle +0 and -0
I can't see any valid reason for using movement to do arithmetic, unless it is bitwise multiplication and division. In those cases we use shifting and not rotation.
Sorry, I do not english terms for this. But for example there is a logical movement(left right), where for example left, means that all bits moves one spot to left and blank spaces ar filled with either 1 or zero. Then there is a circular movement, the same, but instead of blank spaces, bits that goes out of scope comes to those blank spaces, for example circular movement to left by one:
X1X2X3X4 -> X2X3X4X1
And then there is a arithmetical movement(we call it like that in our language), where everything depends on what type of number is given, for example there are numbers that have highest bit as indicator(if highest bit is 1 then number is negative, if highest bit is 0 then it is positive), then there are inverted numbers as I showed before, and the third type is additional code, where all bits are inverted and 1 is added(these three are the most common ways to represent negative numbers in binary as we were told so). So I need to do that arithmetical movement to left by one, when I have a number(that is represented in inverted code).

We were given a table, where for example if I have a number in inverted form, then when number is positive, zeroes are put in blank spaces, and if negative number is given, then 1 are put in blank spaces(after those movements), but the problem is, that I have to write abstract form(I pretend that I don't know which number is given, negative or positive).

For example:
if number is given as additional code, then Arithmetical movmeent to left:
X1X2X3X4 -> X3X400

I need to do the same for inverted format, but as I said, I have two ways to end this, one when number is positive, and other when negative, so I can't simply put 0 or 1 at the end.
 

Papabravo

Joined Feb 24, 2006
21,159
In English the terms are as follows:
Logical Left Shift -- all bits move to the left by 1 position. Most Significant Bit (MSB) ⇒ Carry; 0 ⇒ Least Significant Bit (LSB)
Logical Shift Right -- all bits move to the right by one position. 0 ⇒ MSB; LSB ⇒ Bit bucket

Arithmetic Shift Left -- same as Logical Shift Left
Arithmetic Shift Right -- all bits move 1 position to the right, but the original value of the MSB is copied to itself and the next most significant bit. In this way positive numbers remain positive and negative numbers remain negative.

There are various rotate operations which can move left or right and include or not include the carry flag.
Rotate Right through the Carry
Rotate Left through the Carry
Rotate Right without Carry
Rotate Left without Carry

None of these operations are useful for doing addition or subtraction. They are useful in doing multiplication and division.
 
Top