|WikiProject Computing||(Rated Start-class, Mid-importance)|
When multiplying a negative number written using the one's complement convention, 1, and not 0, should be inserted into the LSB. A clear example of this is 1101 (-2). When left-shifted as described in the article, it'd become 1010 (-5). However, if 1 is put into the LSB, it becomes 1011(-4), the correct answer. So actually, when using one's complement, the signal bit should be reinserted into the LSB after the shift. Budsbd 14:30, 6 March 2007 (UTC)
On arithmetic right shift equivalence to division:
It is stated that arithmetic right shift is not equivalent to division by a power of two, but this is only the case if division of negative rounds towards zero; if on a particular machine division rounds towards negative infinity, the right shift is equivalent.
Also, it is stated that this non-equivalence is the reason C doesn't specify right shift behavior of a negative value. From my understanding, the real reason is simply that right shifts of signed positive integers are common, and some hardware doesn't natively support arithmetic right shifts (only logical, which fills the sign bit with zero), so requiring sign preservation would hurt efficiency on these machines. For the same reason, C doesn't specify the rounding direction when a negative value is divided. C's philosophy is generally to provide what the underlying hardware does (int sizes for example), so >> maps to whatever is provided. -- A reader —Preceding unsigned comment added by 220.127.116.11 (talk) 18:23, 2 February 2008 (UTC)
Shifts in Scheme
I added a footnote on how shifts work in Scheme, as I think it is interesting to show that Shifts do not have to be operators and that a hybrid approach is possible (shift left, right and in any way depending on the operator). --18.104.22.168 (talk) 23:44, 18 May 2008 (UTC)
The article rides about the claim that there is no equivalence of shift and multiplication or division before it gets to the issue. This should not be presented drama-style.
The statement "Logical shifts of binary numbers are only equivalent to division by a power of 2 when the ones' complement representation of signed numbers is being used, for example." lacks explanation, esp. since logical shifts are not applicable to the interpretation of a word as a negative number; I vaguely feel this statement is just nonsense because for a negative number, a logical shift would make it positive in any complement.
The suggested transition from "older ones' complement architectures to newer two's complement architectures" is not historically correct; the first working digital computer (Zuse Z3) did use the 2's complement. — Preceding unsigned comment added by Towopedia (talk • contribs) 15:41, 6 September 2012 (UTC)
Left shift not correct?
The arithmetic left shift diagram appears to be incorrect. It shows the second-most-significant bit being copied into the most-signficant bit. In C (C99) and C++ (11) the result of left shifting a negative signed integral type is undefined behavior. C and C++ can thus be said to have no arithmetic left shift; only logical.
However, in the abstract sense, the most-significant bit should be preserved (+3 becomes +6 and -2 becomes -4). An overflow happens if the most-significant bit is different from any of the N next most significant bits, whether positive or negative. For the diagram to apply to the abstract logical situation, all those bits disappear and MSB remains the same. Anything else is a technical detail dependent on the platform or language. Casu Marzu (talk) 17:51, 30 September 2013 (UTC)
The first picture depicts LOGICAL SHIFT in ARITHMETIC SHIFT
The first pic & its caption (http://en.wikipedia.org/wiki/File:Rotate_left_logically.svg) doesn't go with the text in the Main section of Arithmetic Shift. Please
- remove the first picture
- change its caption stating that it is infact a logic shift operation and is given to differentaite between the two shifts
The caption says "A left arithmetic shift of a binary number by 1..." but it is seen as a "logical shift" as the new bit is filled with zero and not the replicated last bit. — Preceding unsigned comment added by 22.214.171.124 (talk) 05:36, 27 October 2013 (UTC)