bitNot.js (1165B)
1 import { bitNotBigNumber } from '../../utils/bignumber/bitwise.js'; 2 import { deepMap } from '../../utils/collection.js'; 3 import { factory } from '../../utils/factory.js'; 4 import { bitNotNumber } from '../../plain/number/index.js'; 5 var name = 'bitNot'; 6 var dependencies = ['typed']; 7 export 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 });