# Documentation/Calc Functions/BITRSHIFT

Jump to navigation
Jump to search

TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate

## Function name:

BITRSHIFT

## Category:

Mathematical

## Summary:

Shifts a number right by the specified number of bits.

## Syntax:

BITRSHIFT(**Number**; **Shift**)

## Returns:

Returns a number shifted right by the specified number of bits.

## Arguments:

**Number** is a positive integer less than 2 ^ 48 (281,474,976,710,656).

**Shift** is the number of positions the bits will be moved to the right. If shift is negative, it is synonymous with BITLSHIFT (**Number**; -**Shift**).

- If either argument is a decimal number then its floor value is considered.
- If Number is negative, the function returns an error value.

## Additional details:

- Shifting a number right is equivalent to adding zeros (0) to the left of the binary representation of the number. For example, a 1-bit shift to the right on the decimal value 6 converts its binary value (0110) to 0011, or 3 in decimal.
- Using a negative number as the
**Shift**argument shifts the number of bits to the left. Hence it will return the same result as a positive**Shift**argument for the BITLSHIFT function.

## Examples:

Formula | Description | Returns |
---|---|---|

=BITRSHIFT(15;3) | 15 in binary is 1111 which when applied with right shift by 3-bit gives 0001 or (1111 >> 3 = 0001) | 1 (0001) |

=BITRSHIFT(6;-1) | 6 in binary is 0110 which when applied with right shift by -1-bit gives 1100 which is equivalent to left shift by 1-bit or (0110 >> -1 = 1100) | 12 (1100) |

=BITRSHIFT(15.123;3) | floor of 15.123 is taken so 15 in binary is 1111 which when applied with right shift by 3-bit gives 0001 or (1111 >> 3 = 0001) | 1 (0001) |

=BITRSHIFT(15;3.7) | 15 in binary is 1111 which when applied with right shift by 3-bit(floor of 3.7 is considered) gives 0001 or (1111 >> 3 = 0001) | 1 (0001) |

=BITRSHIFT(-15;3) | Number is negative so function returns error value | Err:502 |

## Related LibreOffice functions:

## ODF standard:

## Equivalent Excel functions:

BITRSHIFT