JavaScript >> you don't know

Source: Internet
Author: User
? far greater than symbols

In the mathematical formula, ">>" stands for greater than the symbol, indicating that one number is much larger than another, such as 76>>3,-2>>-99. Poincaré and Borel first used it in 1901, and was soon accepted by the mathematics community.

Collapse edit this paragraph right shift operator

In many computer programming languages (for example: C, C + +, Java, JavaScript, Pascal, and so on), ">>" represents the right-shift operator, which is equivalent to "SHR". The operator is a binocular operator, with the direction left to right, the action is to move all bits of an integer to the right by the specified number of bits, and the extra bits that move beyond the right edge are discarded and moved from the left side to 0.

The two operands of the right-shift operation should be of type integer. The first operand is the number of shift operations to be performed, and the second operand specifies the number of bits that the first operand moves. If the second operand equals 0, no shift occurs.

Application Examples:

Q: Evaluates the value of the expression >> 2.

A: The value of the expression >> 2 is 3 because 14 (that is, the binary 00001110) moves right two bits equals 3 (that is, the binary 00000011).

Plainly, is to move the number into 2, the right to move a few on the right to remove several numbers, left a few on the right to add a few 0, such as 14 right Shift 2 is turned into a binary 1110, minus the right 10, into 11, 11 turns to decimal is 3, the left Shift 2 is 111000, Turn it into a decimal is 56.

JavaScript >> you don't know

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.