Package Exports
- extra-bigint
Readme
A BigInt can represent whole numbers larger than 2⁵³ - 1.
📦 Node.js,
🌐 Web,
📜 Files,
📰 Docs,
📘 Wiki.
The bit is a basic unit of information in information theory, computing. This
package includes bit twiddling hacks by Sean Eron Anderson and many others.
JavaScript converts a Number (a 64-bit floating point number) to a 32-bit
integer when bitwise operators (such as |) are applied. All bitwise operations
are performed on 32-bit integers.
This package is available in Node.js and Web formats. The web format
is exposed as extra_bit standalone variable and can be loaded from
jsDelivr CDN.
Stability: Experimental.
const bigint = require('extra-bigint');
// import * as bigint from "extra-bigint";
// import * as bigint from "https://unpkg.com/extra-bigint/index.mjs"; (deno)
bigint.log2(10n);
bigint.log2(11n);
bigint.log2(12n);
// 3Index
| Name | Action |
|---|---|
| is | Checks if value is a BigInt. |
| isPrime | Checks if value is prime. |
| floorDiv | Gives value ≤ x/y. |
| ceilDiv | Gives value ≥ x/y. |
| abs | Gives absolute value. |
| sign | Gives sign of value. |
| rem | Gets remainder of x/y with sign of x (truncated division). |
| mod | Gets remainder of x/y with sign of y (floored division). |
| modp | Gets remainder of x/y with +ve sign (euclidean division). |
| sqrt | Gives square root of value. |
| cbrt | Gives cube root of value. |
| root | Gives nth root of value. |
| hypot | Gives length of hypotenuse. |
| log2 | Gives base-2 logarithm of value. |
| log10 | Gives base-10 logarithm of value. |
| min | Gives smallest value. |
| max | Gives largest value. |
| range | Gives smallest and largest value. |
| lcm | Gives least common multiple of values. |
| gcd | Gives greatest common divisor of values. |
| hcf | Gives highest common factor of values. |
| sum | Gives sum of values (Σ). |
| product | Gives product of values (∏). |
| arithmeticMean | Gives arithmetic mean of values. |
| geometricMean | Gives geometric mean of values. |
| harmonicMean | Gives harmonic mean of values. |
| cubicMean | Gives cubic mean of values. |
