mathjs/docs/reference/functions/rightArithShift.md
2024-05-31 14:36:43 +02:00

57 lines
1.6 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-rightarithshift">Function rightArithShift <a href="#function-rightarithshift" title="Permalink">#</a></h1>
Bitwise right arithmetic shift of a value x by y number of bits, `x >> y`.
For matrices, the function is evaluated element wise.
For units, the function is evaluated on the best prefix base.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.rightArithShift(x, y)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`x` | number &#124; BigNumber &#124; bigint &#124; Array &#124; Matrix | Value to be shifted
`y` | number &#124; BigNumber &#124; bigint | Amount of shifts
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
number &#124; BigNumber &#124; bigint &#124; Array &#124; Matrix | `x` zero-filled shifted right `y` times
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
math.rightArithShift(4, 2) // returns number 1
math.rightArithShift([16, -32, 64], 4) // returns Array [1, -2, 4]
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[bitAnd](bitAnd.html),
[bitNot](bitNot.html),
[bitOr](bitOr.html),
[bitXor](bitXor.html),
[rightArithShift](rightArithShift.html),
[rightLogShift](rightLogShift.html)