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 🙏

© 2026 – Pkg Stats / Ryan Hefner

hugenumberjs

v2.0.0

Published

A library for storing extremely large numbers in JavaScript.

Readme

hugenumberjs

npm version

hugenumberjs is a library for storing extremely large numbers (up to {10, 1000[2]2} in Bird's array notation or approximately f_ω^ω(1000) in the fast-growing hierarchy) in JavaScript. Supports both Node and browser. It can be used for googology (the study of large numbers) and complex incremental games. It vastly exceeds the limitations of the next-best libraries for this purpose such as https://github.com/Naruyoko/ExpantaNum.js/tree/master but may be slow. You may want to use a simpler library like ExpantaNum.js or https://github.com/Patashu/break_eternity.js if you are not doing as heavy-duty large numbers. There is also some support for very small (near-zero) numbers in this library but it is much more limited than the very large number support, going down to approximately 10^(-(1.8*10^308)).

Numbers are represented in [https://www.mrob.com/users/chrisb/Linear_Array_Notation.pdf](Bird's Linear Array Notation) (or equivalently, linear BEAF), although it is a modified version to support non-integer arguments. Internally this is stored as a property called array, where the first argument is omitted and is an implicit 10 since this is 10-based. Nesting arrays are not allowed (aside from a limited nesting capability provided by the blan10 method)–all elements are stored as base JavaScript numbers and never HugeNumbers. There is also a signproperty equal to 1, 0, or -1 to support 0 and negative numbers. So for example, the number -{10,100,1,1,2}in BLAN would be represented by having the array property set to [100,1,1,2] and the sign property set to -1 since it is a negative number.

Changelog

  • 1.0: Initial release which used chained arrow notation
  • 2.0: New release which is basically a complete overhaul to use BLAN

Continuous Bird's array notation definition

Numbers are represented in [https://www.mrob.com/users/chrisb/Linear_Array_Notation.pdf](Bird's Linear Array Notation) (or equivalently, linear BEAF), although it is a modified version to support non-integer arguments. The formal googological definition of this modified version of BLAN has been put here for convenience.

Let @ represent an arbitrary (possibly empty) comma-separated list of real numbers greater than or equal to 1. An expression is of the form {@}.

Let a, where a is a real number greater than or equal to 1, and b is a positive integer, represent the comma-separated list of a repeated b times.

To evaluate an expression, use the following rules:

  • {} = 1
  • {a} = a
  • {a, b} = a^b
  • {@, 1} = {@}
  • {a, 1, @} = a
  • {a, b, 1, d, @} = {a, b, 1<n + 1>, @}^(2 - d) * {a, b, 1, 2, @}^(d - 1) if 1 < d < 2
  • {a, b, 1, d, @} = {a<n + 1>, a^(b - 1), d - 1, @} if 1 < b < 2 and d > 2
  • {a, b, 1, d, @} = {a<n + 1>, {a, b - 1, 1, d, @}, d - 1, @} if b > 2 and d > 2
  • {a, b, c, @} = {a, b, 1, @}^(2 - c) * {a, b, 1, @}^(c - 1) 1 < c < 2
  • {a, b, c, @} = {a, a^(b - 1), c - 1, @} if 1 < b < 2 and c > 2
  • {a, b, c, @} = {a, {a, b - 1, c, @}, c - 1, @} if b > 2 and c > 2

Method documentation

  • constructor(sign, array): This is the constructor based on the internal representation, taking in the sign and array propertise as described earlier. Note that the array is "normalized" so for example inputting the array [2,2] would have it automatically simplify to [10] since {10,2,2} = {10,10} = 10^10.
  • static fromNumber(num): Converts from a standard (built-in) number to a HugeNumber object.
  • static fromString(str): Converts from a string to a HugeNumber object (currently can include ordinary numbers, scientific notation like 1e+1000, scientific notation with nested exponents like 1e+1e+1000, but not up-arrow notation, BLAN or anything else)
  • clone(): Returns a cloned object of this.
  • abs(): Returns the absolute value of this.
  • neg(): Returns the negation of this.
  • add(other): Returns the sum of this and other.
  • sub(other): Returns the difference of this and other.
  • mul(other): Returns the product of this and other.
  • div(other): Returns the quotient of this and other.
  • mod(other): Returns the modulo of this and other.
  • exp10(): Returns the base-10 exponential function of this.
  • exp(): Returns the base-e exponential function of this.
  • pow(other): Returns this raised to the power of other.
  • sqrt(): Returns the square root of this.
  • cbrt(): Returns the cube root of this.
  • log10(): Returns the base-10 logarithm of this.
  • log(): Returns the natural logarithm of this.
  • logb(b): Returns the base-b logarithm of this.
  • sin(): Returns the sine of this.
  • cos(): Returns the cosine of this.
  • tan(): Returns the tangent of this.
  • asin(): Returns the inverse sine of this.
  • acos(): Returns the inverse cosine of this.
  • atan(): Returns the inverse tangent of this.
  • sinh(): Returns the hyperbolic sine of this.
  • cosh(): Returns the hyperbolic cosine of this.
  • tanh(): Returns the hyperbolic tangent of this.
  • asinh(): Returns the inverse hyperbolic sine of this.
  • acosh(): Returns the inverse hyperbolic cosine of this.
  • atanh(): Returns the inverse hyperbolic tangent of this.
  • floor(): Returns the floor function of this.
  • ceil(): Returns the ceiling function of this.
  • round(): Returns the round to nearest integer function of this.
  • trunc(): Returns the truncate function of this.
  • tetr10(): Returns 10 tetrated to this. If you want to do pentation or higher with base 10 see the blan10 method.
  • tetr(other): Returns this tetrated to other (may be buggy or slow for bases very close to e^(1/e) ≈ 1.445).
  • lambertw(): Returns the Lambert W function of this.
  • ssqrt(): Returns the super-square root of this.
  • slog10(other): Returns the base-10 superlogarithm of this.
  • slogb(b): Returns the base-b superlogarithm of this (may be buggy or slow for bases very close to e^(1/e) ≈ 1.445).
  • blan10(array): Returns {10, this, array[0], array[1], array[2], array[3]....} in Bird's Linear Array Notation. For example: HugeNumber.fromNumber(11).blan10([12,13]) would return {10,11,12,13} in Bird's Linear Array Notation. The elements of the array have to be standard numbers not HugeNumbers. This is the only way to do pentation or higher currently, and it is only base 10. 10 pentated to is x.blan10([3]) since it's {10,x,3} in BLAN.
  • cmp(other): "Three-way comparison" opearator (returns -1 if this < other, 0 if this === other, 1 if this > other)
  • eq(other): Equal to
  • ne(other): Not equal to
  • lt(other): Less than
  • le(other): Less than or equal
  • gt(other): Greater than
  • ge(other): Greater than or equal
  • min(other): Returns the minimum of this and other.
  • max(other): Returns the maximum of this and other.
  • toNumber(): Converts a HugeNumber object to a standard (built-in) number. (if the HugeNumber is too large to be converted to a standard number, this will return Infinity)
  • toString(): Converts a HugeNumber object to a string representation.