# Documentation/Calc Functions/BITLSHIFT

Jump to navigation
Jump to search

Template:TopMenu/en Template:Menu/en Template:Menu.Documentation/en

## Function name:

BITLSHIFT

## Category:

Mathematical

## Summary:

Left shifts a non-negative integer value by the specified number of bits.

## Syntax:

BITLSHIFT(**Number**; **Shift**)

## Returns:

Returns a non-negative integer, that is the original number shifted by the specified number of bits.

## Arguments:

**Number** is an integer in the range [0, 2^{48}-1], or a reference to a cell containing that number, that is the value to be shifted.

**Shift** is an integer, or a reference to a cell containing that number, that is the number of bit positions to shift. If **Shift** is positive, then **Number** is shifted to the left. If **Shift** is negative, then **Number** is shifted to the right and this would be equivalent to BITRSHIFT(**Number**; -**Shift**).

- If either
**Number**or**Shift**is non-numeric, then BITLSHIFT reports a #VALUE! error. - If either
**Number**or**Shift**is a non-integer value, then BITLSHIFT converts it to an integer by taking its floor value. - If
**Number**is less than 0 or greater than 2^{48}-1, then BITLSHIFT reports an invalid argument error (Err:502).

## Additional details:

- A left shift by
*N*(*N*> 0) is equivalent to multiplying by 2^{N}and effectively adds zeros at the right end of the binary representation of the number. - More information is available on Wikipedia’s Bitwise operation page.
- 2
^{48}is equal to 281474976710656.

## Examples:

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

=BITLSHIFT(6; 3) | 6 is binary 0110. The function shifts this value left by three bits, to give binary 0110000 or decimal 48. | 48 |

=BITLSHIFT(D1; D2) where cells D1 and D2 contain the numbers 6 and -1 respectively. | 6 is binary 0110. Because the Shift argument is negative, the function shifts the value 6 right by one bit, to give binary 0011 or decimal 3. |
3 |

=BITLSHIFT(6.123; 3.9) | The floor values of the two arguments are taken, giving 6 (binary 0110) and 3. The function shifts the value 6 left by three bits, to give binary 0110000 or decimal 48. | 48 |

## Related LibreOffice functions:

## ODF standard:

## Equivalent Excel functions:

BITLSHIFT