UNPKG

1.17 kBJavaScriptView Raw
1import { bitNotBigNumber } from '../../utils/bignumber/bitwise.js';
2import { deepMap } from '../../utils/collection.js';
3import { factory } from '../../utils/factory.js';
4import { bitNotNumber } from '../../plain/number/index.js';
5var name = 'bitNot';
6var dependencies = ['typed'];
7export var createBitNot = /* #__PURE__ */factory(name, dependencies, (_ref) => {
8 var {
9 typed
10 } = _ref;
11
12 /**
13 * Bitwise NOT value, `~x`.
14 * For matrices, the function is evaluated element wise.
15 * For units, the function is evaluated on the best prefix base.
16 *
17 * Syntax:
18 *
19 * math.bitNot(x)
20 *
21 * Examples:
22 *
23 * math.bitNot(1) // returns number -2
24 *
25 * math.bitNot([2, -3, 4]) // returns Array [-3, 2, 5]
26 *
27 * See also:
28 *
29 * bitAnd, bitOr, bitXor, leftShift, rightArithShift, rightLogShift
30 *
31 * @param {number | BigNumber | Array | Matrix} x Value to not
32 * @return {number | BigNumber | Array | Matrix} NOT of `x`
33 */
34 return typed(name, {
35 number: bitNotNumber,
36 BigNumber: bitNotBigNumber,
37 'Array | Matrix': function ArrayMatrix(x) {
38 return deepMap(x, this);
39 }
40 });
41});
\No newline at end of file