simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

bitNot.js (1350B)


      1 "use strict";
      2 
      3 Object.defineProperty(exports, "__esModule", {
      4   value: true
      5 });
      6 exports.createBitNot = void 0;
      7 
      8 var _bitwise = require("../../utils/bignumber/bitwise.js");
      9 
     10 var _collection = require("../../utils/collection.js");
     11 
     12 var _factory = require("../../utils/factory.js");
     13 
     14 var _index = require("../../plain/number/index.js");
     15 
     16 var name = 'bitNot';
     17 var dependencies = ['typed'];
     18 var 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   return typed(name, {
     44     number: _index.bitNotNumber,
     45     BigNumber: _bitwise.bitNotBigNumber,
     46     'Array | Matrix': function ArrayMatrix(x) {
     47       return (0, _collection.deepMap)(x, this);
     48     }
     49   });
     50 });
     51 exports.createBitNot = createBitNot;