Skip to content
extra-integer / 2.1.35

extra-integer 2.1.35

Install from the command line:
Learn more about npm packages
$ npm install @nodef/extra-integer@2.1.35
Install via package.json:
"@nodef/extra-integer": "2.1.35"

About this version

Common operations for 32-bit integers.
πŸ“¦ Node.js, 🌐 Web, πŸ“œ Files, πŸ“° Docs, πŸ“˜ Wiki.

A 32-bit integer can store values from βˆ’2^31 (MIN_VALUE) to 2^31 βˆ’ 1 (MAX_VALUE). JavaScript converts a Number (a 64-bit floating point number) to a 32-bit integer (int32) when bitwise operators (such as |) are applied. Use is to check is a number can be represented as a 32-bit integer. Sign-based operations include abs and signEqual. Power/logarithm related operations include isPow2, prevPow2, nextPow2, pow2, pow10, log2, and log10.

This package is available in Node.js and Web formats. The web format is exposed as extra_integer standalone variable and can be loaded from jsDelivr CDN.

Stability: Experimental.


const xinteger = require('extra-integer');
// import * as xinteger from "extra-integer";
// import * as xinteger from "https://unpkg.com/extra-integer/index.mjs"; (deno)

xinteger.is(9.11e-31);
// β†’ false

xinteger.log10(10000);
// β†’ 4

xinteger.nextPow2(63);
// β†’ 64


Index

Property Description
MIN_VALUE Minimum int32 value.
MAX_VALUE Maximum int32 value.
is Check if value is int32.
abs Get the absolute of an int32.
signEqual Check if two int32s have equal sign.
isPow2 Check if int32 is a power-of-2.
prevPow2 Find previous power-of-2 of an int32.
nextPow2 Find next power-of-2 of an int32.
pow2 Find the power-of-2 of an int32.
pow10 Find the power-of-10 of an int32.
log2 Find the base-2 logarithm of an int32.
log10 Find the base-10 logarithm of an int32.


References




ORG DOI Coverage Status Test Coverage Maintainability

Details


Assets

  • extra-integer-2.1.35.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0