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?
Asked
Active
Viewed 1,127 times
3
-
1When you need to find out the features of a language, it is best to search for keywords like "reference", "operator", "statement", followed by the name of the language. That would solve the problem of looking for symbols. – Ates Goral Sep 17 '09 at 04:12
4 Answers
2
It's a bit shifting operator: http://www.contactor.se/~dast/fpl-old/language/shift.HTML

brianreavis
- 11,562
- 3
- 43
- 50
1
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
- 28,134
- 6
- 57
- 76
1
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
- 48,337
- 13
- 89
- 105