I'm translating a JavaScript algorithm into PHP, and I ran into the symbol >>, and I have no clue what it means. It's hard to search Google for symbols, so can anyone tell me what it means?
A:
binarycoder
2009-09-17 02:27:35
+2
A:
It's a bit shifting operator: http://www.contactor.se/~dast/fpl-old/language/shift.HTML
brianreavis
2009-09-17 02:27:40
+1
A:
It is a sign-propagating right shift. Many, many, languages have this operator.
Wikipedia has a good article on the subject. My first link has a few examples and an explanation.
Nick Presta
2009-09-17 02:28:27
A:
>>
This is the sign-propagating right shift operator which shifts the digits of the binary representation of the first operand to the right by the number of places specified by the second operand, discarding any shifted off to the right.
rick schott
2009-09-17 02:31:39
+1
A:
Other answers are correct, but this may be of help to you: If x is positive then
x >> y
is the same as
floor(x / (2 ** y))
where 2**y is 2 raised to the power y.
E.g. x >> 3
is the same as floor(x / 8)
.
Artelius
2009-09-17 03:01:15