hugenumberjs
v1.0.1
Published
A library for storing extremely large numbers (up to {10, 1000, 1, 1, 2}) in JavaScript.
Downloads
5
Maintainers
Readme
hugenumberjs
A library for storing extremely large numbers (up to {10, 1000, 1, 1, 2}) in JavaScript. Supports both Node and browser.
Internally, number is represented as a sign (1 if positive, -1 if negative) and array. The value represented is sign
* 10 → array[0]
→ array[1]
→ array[2]
→ array[2]
... in chained arrow notation
(specifically Fish's real number extension of it).
Changelog
- 1.0: Initial release
Methods
constructor(sign, array)
: Convert from sign and arrayconstructor(num)
: Convert from standard numberconstructor(str)
: Convert from string, currently can include scientific notation (even nested exponent like "1e1e1e1e500") but not arrowsnormalize()
: Normalize propertiesclone()
: Object cloneabs()
: Absolute valueneg()
: Negateadd(other)
: Addsub(other)
: Subtractmul(other)
: Multiplydiv(other)
: Dividemod(other)
: Moduloexp()
: Base e exponentialexp10()
: Base 10 exponentialpow(other)
: Raise to powersqrt()
: Square rootcbrt()
: Cube rootlog()
: Base e logarithmlog10()
: Base 10 logarithmlogb(base)
: Arbitrary base logarithmfloor()
: Floorceil()
: Ceilinground()
: Round to nearest integersin()
: Sinecos()
: Cosinetan()
: Tangentasin()
: Inverse sineacos()
: Inverse cosineatan()
: Inverse tangentcmp(other)
: Compare to (returns -1 ifthis < other
, 0 ifthis === other
, 1 ifthis > other
)eq(other)
: Equal tone(other)
: Not equal tolt(other)
: Less thanle(other)
: Less than or equalgt(other)
: Greater thange(other)
: Greater than or equalmin(other)
: Minimummax(other)
: MaximumtoNumber()
: Convert to standard numbertoString()
: Convert to stringtoExponential()
: Convert to scientific notation string (including nested exponents)toArrow()
: Convert to arrow notation stringtoChainedArrow()
: Convert to chained arrow notation string