contents.gifindex.gifprev1.gifnext1.gif

Zero-Fill Right Shift

Format: x >>> y

Arguments: (int) x, y Any integers

Returns: (int) The value of x with all bits shifted right y places

Description: This operator converts x from a floating-point number to a 32-bit integer, shifts all bits y places to the right, and then returns the result as a floating-point number.

The difference between Right Shift and Zero-Fill Right Shift is in how the sign bit is treated. With Right Shift, the sign is preserved by keeping the most significant bit unchanged. With Zero-Fill Right Shift, the most significant bit is set to zero.

Examples: 16>>>3 = 2  (10000 >>> 3 = 00010)

  12>>>2 = 3  (01100 >>> 2 = 00011)

  -12>>>2 = 1073741821  (sign is not preserved)

See Also: Right Shift, Left Shift, Bitwise And, Bitwise Or, Bitwise Exclusive Or, Bitwise Not

Vanguard Software Applications

Our collaborative, web-based forecasting applications unite roles, teams and departments in achieving the most accurate forecasts in the world – bar none.