npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-math-bigint

v5.5.1

Published

BigInt.js based on original work by Leemon Baird

Downloads

5

Readme

bigint.js

Big Integer Library v. 5.5

  • based on original by Leemon Baird (www.leemon.com)

Installing

Browser

  <script src="bigint.js"></script>

Node.js

https://www.npmjs.com/package/node-math-bigint

  npm install node-math-bigint --save

Source

  git clone https://github.com/TimothyMeadows/bigintjs

Methods

bigInt add(x,y)

return (x+y) for bigInts x and y.

bigInt addInt(x,n)

return (x+n) where x is a bigInt and n is an integer.

string bigInt2str(x,base)

return a string form of bigInt x in a given base, with 2 <= base <= 95

int bitSize(x)

return how many bits long the bigInt x is, not counting leading zeros

bigInt dup(x)

return a copy of bigInt x

boolean equals(x,y)

is the bigInt x equal to the bigint y?

boolean equalsInt(x,y)

is bigint x equal to integer y?

bigInt expand(x,n)

return a copy of x with at least n elements, adding leading zeros if needed

Array findPrimes(n)

return array of all primes less than integer n

bigInt GCD(x,y)

return greatest common divisor of bigInts x and y (each with same number of elements).

boolean greater(x,y)

is x>y? (x and y are nonnegative bigInts)

boolean greaterShift(x,y,shift)

is (x <<(shift*bpe)) > y?

bigInt int2bigInt(t,n,m)

return a bigInt equal to integer t, with at least n bits and m array elements

bigInt inverseMod(x,n)

return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null

int inverseModInt(x,n)

return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse

boolean isZero(x)

is the bigInt x equal to zero?

boolean millerRabin(x,b)

does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is bigInt, 1<b<x)

boolean millerRabinInt(x,b)

does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is int, 1<b<x)

bigInt mod(x,n)

return a new bigInt equal to (x mod n) for bigInts x and n.

int modInt(x,n)

return x mod n for bigInt x and integer n.

bigInt mult(x,y)

return x*y for bigInts x and y. This is faster when y<x.

bigInt multMod(x,y,n)

return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.

boolean negative(x)

is bigInt x negative?

bigInt powMod(x,y,n)

return (xy mod n) where x,y,n are bigInts and ** is exponentiation. 00=1. Faster for odd n.

bigInt randBigInt(n,s)

return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.

bigInt randTruePrime(k)

return a new, random, k-bit, true prime bigInt using Maurer's algorithm.

bigInt randProbPrime(k)

return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80).

bigInt str2bigInt(s,b,n,m)

return a bigInt for number represented in string s in base b with at least n bits and m array elements

bigInt sub(x,y)

return (x-y) for bigInts x and y. Negative answers will be 2s complement

bigInt trim(x,k)

return a copy of x with exactly k leading zero elements