rightArithShift

x >> y

rightArithShift(x, y)

Try it yourself:


rightArithShift(): Signed Bit Shift Right

rightArithShift() shifts integer bits right while preserving the sign bit. It approximates division by powers of two for signed integer values, with behavior determined by integer representation.

Signed behavior

This differs from rightLogShift(), which fills left positions with zeros. Use leftShift() for the opposite direction and bitAnd() to inspect flags.

Use integer operands and nonnegative shift counts. Negative values and large shifts should be tested against the platform’s bit-width rules rather than assumed from decimal arithmetic.

Try Right Arith Shift in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions