UNPKG

1.04 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function leftShift
4
5Bitwise left logical shift of a value x by y number of bits, `x << y`.
6For matrices, the function is evaluated element wise.
7For units, the function is evaluated on the best prefix base.
8
9
10## Syntax
11
12```js
13math.leftShift(x, y)
14```
15
16### Parameters
17
18Parameter | Type | Description
19--------- | ---- | -----------
20`x` | number &#124; BigNumber &#124; Array &#124; Matrix | Value to be shifted
21`y` | number &#124; BigNumber | Amount of shifts
22
23### Returns
24
25Type | Description
26---- | -----------
27number &#124; BigNumber &#124; Array &#124; Matrix | `x` shifted left `y` times
28
29
30## Examples
31
32```js
33math.leftShift(1, 2) // returns number 4
34
35math.leftShift([1, 2, 3], 4) // returns Array [16, 32, 64]
36```
37
38
39## See also
40
41[leftShift](leftShift.md),
42[bitNot](bitNot.md),
43[bitOr](bitOr.md),
44[bitXor](bitXor.md),
45[rightArithShift](rightArithShift.md),
46[rightLogShift](rightLogShift.md)