UNPKG

1.36 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.createBitNot = void 0;
7
8var _bitwise = require("../../utils/bignumber/bitwise");
9
10var _collection = require("../../utils/collection");
11
12var _factory = require("../../utils/factory");
13
14var _number = require("../../plain/number");
15
16var name = 'bitNot';
17var dependencies = ['typed'];
18var createBitNot = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
19 var typed = _ref.typed;
20
21 /**
22 * Bitwise NOT value, `~x`.
23 * For matrices, the function is evaluated element wise.
24 * For units, the function is evaluated on the best prefix base.
25 *
26 * Syntax:
27 *
28 * math.bitNot(x)
29 *
30 * Examples:
31 *
32 * math.bitNot(1) // returns number -2
33 *
34 * math.bitNot([2, -3, 4]) // returns Array [-3, 2, 5]
35 *
36 * See also:
37 *
38 * bitAnd, bitOr, bitXor, leftShift, rightArithShift, rightLogShift
39 *
40 * @param {number | BigNumber | Array | Matrix} x Value to not
41 * @return {number | BigNumber | Array | Matrix} NOT of `x`
42 */
43 var bitNot = typed(name, {
44 number: _number.bitNotNumber,
45 BigNumber: _bitwise.bitNotBigNumber,
46 'Array | Matrix': function ArrayMatrix(x) {
47 return (0, _collection.deepMap)(x, bitNot);
48 }
49 });
50 return bitNot;
51});
52exports.createBitNot = createBitNot;
\No newline at end of file