ExpantaNum.js Docs

This document uses Rainbow with rainbow.css for syntax highlighting.

Properties

array

An array of integers that stores a part of the magnitude of ExpantaNum.
Array [[a0,b0],[a1,b1],[a2,b2],[a3,b3],...] represents the magnitude, conditionally:

It is always standardized to meet the following requirements(the value must be equivalent):

layer

Number representing a part of the magnitude of ExpantaNum. An integer greater than or equal to 0 and less than or equal to 9007199254740991. Together with array, it represents Jlayer [value represented by array], where Jx=10{x}10.

sign

Number representing the sign of ExpantaNum. Either 1 or -1. 1 means positive, -1 means negative.

Methods (Arithmetic)

absoluteValue abs

Static: ExpantaNum.absoluteValue(x), ExpantaNum.abs(x)
Instance: <ExpantaNum>.absoluteValue(), <ExpantaNum>.abs()
Returns the absolute value of method.

        ExpantaNum("10^^ee5").abs().toString() //"10^^ee5"
        ExpantaNum.abs(-3.7e52).toString() //"3.7e52"
      

arrow

Static: ExpantaNum.arrow(x,z,y)
Instance: <ExpantaNum>.arrow(z)(y)
For static method, it is in form ExpantaNum.arrow(x,arrows,y), while non-static method is x.arrow(arrows)(y). Uses linear approximation for real height.

        ExpantaNum(13).arrow(3)(5).toString() //"(10^^)^3 (10^)^11 337385711567664.9"
        ExpantaNum.arrow(6,4,5).toString() //"(10^^^)^3 (10^^)^4 eeee36305.31580191892"
        ExpantaNum.arrow(6,4,5.001).toString() //"(10^^^)^3 (10^^)^4 eeeeeee394749617.28181416"
      
For non-static method, not having the second parameter will return function of the arrows.

ceiling ceil

Static: ExpantaNum.ceiling(x), ExpantaNum.ceil(x)
Instance: <ExpantaNum>.ceiling(), <ExpantaNum>.ceil()
Returns the ceiling of method.

        ExpantaNum(2.34).ceil().toString() //"3"
        ExpantaNum.ceil(-24.32).toString() //"-24"
      

compareTo cmp

Static: ExpantaNum.compare(x,y), ExpantaNum.cmp(x,y)
Instance: <ExpantaNum>.compareTo(y), <ExpantaNum>.cmp(y)
Compares two numbers, returns 1 if greater, 0 if equal, and -1 if less than.

        ExpantaNum(5).cmp(3) //1
        ExpantaNum.cmp(-8,3) //-1
        ExpantaNum.cmp(6,6) //0
      

cubeRoot cbrt

Static: ExpantaNum.cubeRoot(x), ExpantaNum.cbrt(x)
Instance: <ExpantaNum>.cubeRoot(), <ExpantaNum>.cbrt()
Returns the cube root of the number.

        ExpantaNum(5).cbrt().toNumber() //1.709975946676697
        ExpantaNum.cbrt(-4).toNumber() //-1.5874010519681994
        ExpantaNum.cbrt(3).toNumber() //1.4422495703074083
      

divide div

Static: ExpantaNum.divide(x,y), ExpantaNum.div(x,y)
Instance: <ExpantaNum>.divide(y), <ExpantaNum>.div(y)
Divides number by another.

        ExpantaNum.div(6,2).toString() //"3"
        ExpantaNum.div("ee5",2).toString() //"4.999999999978076e99999"
        ExpantaNum.div("ee5","-10^^3").toString() //"-0"
      
That impresision tho

equalsTo eq

Static: ExpantaNum.equalsTo(x,y), ExpantaNum.eq(x,y)
Instance: <ExpantaNum>.equalsTo(y), <ExpantaNum>.eq(y)
Returns whether two numbers are equal.

        ExpantaNum.div(5,5) //true
        ExpantaNum.div(0,120) //false
        ExpantaNum.div("10^^e16",[16,1,1]) //true
      

expansion

Static: ExpantaNum.expansion(x,y)
Instance: <ExpantaNum>.expansion(y)
exp function. exp(x)=ex

        ExpantaNum.expansion(2,1).toString() //"2"
        ExpantaNum.expansion(2,10).toString() //"4"
        ExpantaNum.expansion(3,64).toString() //"J^62 (10^)^7625597484984 3638334640023.7783"
      

exponential exp

Static: ExpantaNum.exponential(x), ExpantaNum.exp(x)
Instance: <ExpantaNum>.exponential(), <ExpantaNum>.exp()
exp function. exp(x)=ex

        ExpantaNum.exp(5).toString() //"148.41315910257657"
        ExpantaNum.exp(1e+200).toString() //"e4.342944819032647e199"
        ExpantaNum.exp("10^^100").toString() //"(10^)^99 10000000000"
      

factorial fact

Static: ExpantaNum.factorial(x), ExpantaNum.fact(x)
Instance: <ExpantaNum>.factorial(), <ExpantaNum>.fact()
Factorial. Currently, it does not support non-integer input.

        ExpantaNum.fact(10).toString() //"3628800"
        ExpantaNum.fact(1e100).toString() //"e9.956570551809593e101"
      

floor

Static: ExpantaNum.floor(x)
Instance: <ExpantaNum>.floor()
Returns floor of number.

        ExpantaNum.floor(12.7).toString() //"12"
        ExpantaNum.floor("ee5e23").toString() //"eee23.69897000433602"
      

gamma

Static: ExpantaNum.gamma(x)
Instance: <ExpantaNum>.gamma()
Applies Gamma function.

        ExpantaNum.gamma(0.5).toString() //"2"
        ExpantaNum.gamma(5).toString() //"24.00018258045251"
        ExpantaNum.gamma(1e50).toString() //"e4.956570551809682e51"
      

generalLogarithm log10

Static: ExpantaNum.generalLogarithm(x), ExpantaNum.log10(x)
Instance: <ExpantaNum>.generalLogarithm(), <ExpantaNum>.log10()
Returns general logarithm(log base 10) of number.

        ExpantaNum.log10(62.69).toString() //"1.797198269838959"
        ExpantaNum.log10("eee6.19").toString() //"4.15826806220026e1548816"
      

greaterThan gt

Static: ExpantaNum.greaterThan(x,y), ExpantaNum.gt(x,y)
Instance: <ExpantaNum>.greaterThan(x,y), <ExpantaNum>.gt(x,y)
Returns whether number is greater than other.

        ExpantaNum.gt(102,512) //false
        ExpantaNum.gt("ee4e5923","e43.348") //true
        ExpantaNum.gt(5,5) //false
      

greaterThanOrEqualTo gte

Static: ExpantaNum.greaterThanOrEqualTo(x,y), ExpantaNum.gte(x,y)
Instance: <ExpantaNum>.greaterThanOrEqualTo(y), <ExpantaNum>.gte(y)
Returns whether number is greater than or equal to other.

        ExpantaNum.gte(102,512) //false
        ExpantaNum.gte("ee4e5923","e43.348") //true
        ExpantaNum.gte(5,5) //true
      

hyper

Static: ExpantaNum.hyper(z)(x,y)
Instance: None
Static only. ExpantaNum.hyper(z)(x,y)=hyper-z(x,y).

        ExpantaNum.hyper(4)(4,2).toString() //"256"
        ExpantaNum.hyper(12)(923,592).toString() //"(10{9})^590 (10{8})^921 (10{7})^921 (10{6})^921 (10{5})^921 (10^^^^)^921 (10^^^)^921 (10^^)^921 (10^)^922 2737.3532242875053"
      

isFinite

Static: ExpantaNum.isFinite(x)
Instance: <ExpantaNum>.isFinite()
Returns whether number is finite.

        ExpantaNum.isFinite(6) //true
        ExpantaNum.isFinite(NaN) //false
        ExpantaNum.isFinite(Infinity) //false
      

isInfinite

Static: ExpantaNum.isInfinite(x)
Instance: <ExpantaNum>.isInfinite()
Returns whether number is infinite.

        ExpantaNum.isInfinite(6) //false
        ExpantaNum.isInfinite(NaN) //false
        ExpantaNum.isInfinite(Infinity) //true
      

isInteger isint

Static: ExpantaNum.isInteger(x), ExpantaNum.isint(x)
Instance: <ExpantaNum>.isInteger(), <ExpantaNum>.isint()
Returns whether number is an integer.

        ExpantaNum.isint(4) //true
        ExpantaNum.isint(8.2) //false
      

isNaN

Static: ExpantaNum.isNaN(x)
Instance: <ExpantaNum>.isNaN()
Returns whether number is NaN.

        ExpantaNum.isNaN(3) //false
        ExpantaNum.isNaN(NaN) //true
      

isNegative isneg

Static: ExpantaNum.isNegative(x), ExpantaNum.isNeg(x)
Instance: <ExpantaNum>.isNegative(), <ExpantaNum>.isNeg()
Returns whether number is negative.

        ExpantaNum.isneg(5) //false
        ExpantaNum.isneg(-3) //true
      

isPositive ispos

Static: ExpantaNum.isPositive(x), ExpantaNum.ispos(x)
Instance: <ExpantaNum>.isPositive(), <ExpantaNum>.ispos()
Returns whether number is positive.

        ExpantaNum.ispos(5) //true
        ExpantaNum.ispos(-3) //false
      

iteratedexp

Static: ExpantaNum.iteratedexp(x,y[,z])
Instance: <ExpantaNum>.iteratedexp(y[,z])
Alias for tetr.

iteratedlog

Static: ExpantaNum.iteratedlog(x,y,z)
Instance: <ExpantaNum>.iteratedlog(y,z)
Repeatedly applies log base y to x z times. z can be real.

lambertw

Static: ExpantaNum.lambertw(x)
Instance: <ExpantaNum>.lambertw()
Applies Lambert W function.

        ExpantaNum.lambert(-0.1).toString() //"-0.11183255915896297"
        ExpantaNum.lambert(1).toString() //"0.5671432904097838"
        ExpantaNum.lambert(10).toString() //"1.7455280027406992"
      

layeradd

Static: ExpantaNum.layeradd(x,y,z)
Instance: <ExpantaNum>.layeradd(y,z)
Adds z layers of exponential tower of base y of x at the bottom. z can be real.

layeradd10

Static: ExpantaNum.layeradd10(x,y)
Instance: <ExpantaNum>.layeradd10(y)
Adds y layers of exponential tower of base 10 of x at the bottom. y can be real.

lessThan lt

Static: ExpantaNum.lessThan(x,y), ExpantaNum.lt(x,y)
Instance: <ExpantaNum>.lessThan(y), <ExpantaNum>.lt(y)
Returns whether number is less than other.

        ExpantaNum.lt(102,512) //true
        ExpantaNum.lt("ee4e5923","e43.348") //false
        ExpantaNum.lt(5,5) //false
      

lessThanOrEqualTo lte

Static: ExpantaNum.lessThanOrEqualTo(x,y), ExpantaNum.lte(x,y)
Instance: <ExpantaNum>.lessThanOrEqualTo(y), <ExpantaNum>.lte(y)
Returns whether number is less than or equal to other.

        ExpantaNum.lte(102,512) //true
        ExpantaNum.lte("ee4e5923","e43.348") //false
        ExpantaNum.lte(5,5) //true
      

logarithm logBase

Static: ExpantaNum.logarithm(x[,y]), ExpantaNum.logBase(x[,y])
Instance: <ExpantaNum>.logarithm([y]), <ExpantaNum>.logBase([y])
Returns logarithm of number with a base.

        ExpantaNum(3).logBase(2).toString() //"1.584962500721156"
        ExpantaNum.logBase("e3.5e393",5891).toString() //"9.283354173739596e392"
      

minus sub

Static: ExpantaNum.minus(x,y), ExpantaNum.sub(x,y)
Instance: <ExpantaNum>.minus(y), <ExpantaNum>.sub(y)
Subtraction.

        ExpantaNum.sub(634,623).toString() //"11"
        ExpantaNum.sub("ee6.238","ee6.239").toString() //"-9.948420585793617e1733803"
      

modular mod

Static: ExpantaNum.modular(x,y), ExpantaNum.mod(x,y)
Instance: <ExpantaNum>.modular(y), <ExpantaNum>.mod(y)
Modulo operation without floor.

        ExpantaNum.mod(32,7).toString() //"4"
        ExpantaNum.mod("e13.523",6232).toString() //"1683.47265625"
      

naturalLogarithm log ln

Static: ExpantaNum.naturalLogarithm(x), ExpantaNum.log(x), ExpantaNum.ln(x)
Instance: <ExpantaNum>.naturalLogarithm(), <ExpantaNum>.log(), <ExpantaNum>ln()
Returns the natural logaritha.

        ExpantaNum.ln(382.42).toString() //"5.946519481064813"
        ExpantaNum.ln("eee1").toString() //"23025850929.940456"
      

negate neg

Static: ExpantaNum.negate(x), ExpantaNum.neg(x)
Instance: <ExpantaNum>.negate(), <ExpantaNum>.neg()
Returns the negated value.

        ExpantaNum.neg(523).toString() //"-523"
        ExpantaNum.neg(-921.3).toString() //"-921.3"
      

notEqualsTo neq

Static: ExpantaNum.notEqualsTo(x,y), ExpantaNum.notEqual(x,y), ExpantaNum.neq(x,y)
Instance: <ExpantaNum>.notEqualsTo(y), <ExpantaNum>.notEqual(y), <ExpantaNum>.neq(y)
Returns whether two numbers are not equal.

        ExpantaNum.div(5,5) //false
        ExpantaNum.div(0,120) //true
        ExpantaNum.div("10^^e16",[16,1,1]) //false
      

pentate pent

Static: ExpantaNum.pentate(x,y), ExpantaNum.pent(x,y)
Instance: <ExpantaNum>.pentate(y), <ExpantaNum>.pent(y)
Pentation. Uses linear approximation for real height.

        ExpantaNum.pent(3,3).toString() //"(10^)^7625597484984 3638334640023.7783"
        ExpantaNum.pent(3,3.1).toString() //"10^^1.0184927774689214e591"
        ExpantaNum.pent("e5e18","ee5e10").toString() //"10^^^e1e50000000000"
      

plus add

Static: ExpantaNum.plus(x,y), ExpantaNum.add(x,y)
Instance: <ExpantaNum>.plus(y), <ExpantaNum>.add(y)
Addition.

        ExpantaNum.add(63942334,"e16.523").toString() //"3.334264134026562e16"
        ExpantaNum.add(3923,-34823).toString() //"-30900"
      

reciprocate rec

Static: ExpantaNum.reciprocate(x), ExpantaNum.rec(x)
Instance: <ExpantaNum>.reciprocate(), <ExpantaNum>.rec()
Returns the reciprocal.

        ExpantaNum.rec(432).toString() //"0.0023148148148148147"
        ExpantaNum.rec(-0.00045).toString() //"-2222.222222222222"
      

root

Static: ExpantaNum.root(x,y)
Instance: <ExpantaNum>.root(y)
Returns the y-th root of x.

        ExpantaNum.root(523,4).toString() //"4.782174531743749"
        ExpantaNum.root(252.43,7).toString() //"2.203753399900375"
      

round

Static: ExpantaNum.round(x)
Instance: <ExpantaNum>.round()
Returns the rounded number.

        ExpantaNum.round(52.32).toString() //"52"
        ExpantaNum.round(-68.23).toString() //"-68"
      

slog

Static: ExpantaNum.slog(x[,y])
Instance: <ExpantaNum>.slog([y])
Applies super-logarithm. Uses linear approximation for real height.

        ExpantaNum.slog(0,10).toString() //"-1"
        ExpantaNum.slog(2,10).toString() //"0.30102999566398125"
        ExpantaNum.slog(3814279.1047601975,Math.E).toString() //"3"
      

squareRoot sqrt

Static: ExpantaNum.squareRoot(x), ExpantaNum.sqrt(x)
Instance: <ExpantaNum>.squareRoot(), <ExpantaNum>.sqrt()
Returns the square root.

        ExpantaNum.sqrt(16).toString() //"4"
        ExpantaNum.sqrt("e5e10").toString() //"1e25000000000"
        ExpantaNum.sqrt(-1).toString() //"NaN"
      

ssqrt ssrt

Static: ExpantaNum.ssqrt(x), ExpantaNum.ssrt(x)
Instance: <ExpantaNum>.ssqrt(), <ExpantaNum>.ssrt()
Applies square super-root.

        ExpantaNum.ssrt(2).toString() //"1.5596104694623696"
        ExpantaNum.ssrt(27).toString() //"3.0000000000000004"
        ExpantaNum.ssrt("ee50").toString() //"2.0697116195395227e48"
      

tetrate tetr

Static: ExpantaNum.tetrate(x,y[,z]), ExpantaNum.tetr(x,y[,z])
Instance: <ExpantaNum>.tetrate(y[,z]), <ExpantaNum>.tetr(y[,z])
Tetration. Uses linear approximation for real height. z is placed on top of exponential tower (thus becoming iterated exponentiation).

        ExpantaNum.tetr(3,3).toString() //"7625597484987"
        ExpantaNum.tetr(10,2.5).toString() //"1.0972406760152253e1453"
        ExpantaNum.tetr("e5e52",512).toString() //"(10^)^513 52.69897000433602"
        ExpantaNum.tetr(1.2,Infinity).toString() //"1.2577345413765264"
      

times mul

Static: ExpantaNum.times(x,y), ExpantaNum.mul(x,y)
Instance: <ExpantaNum>.times(y), <ExpantaNum>.mul(y)
Multiplication.

        ExpantaNum.mul(120,5).toString() //"600"
        ExpantaNum.mul("e8e12","e2e13").toString() //"1e28000000000000"
      

toPower pow

Static: ExpantaNum.toPower(x,y), ExpantaNum.pow(x,y)
Instance: <ExpantaNum>.toPower(y), <ExpantaNum>.pow(y)
Exponentiation.

        ExpantaNum.pow(5,5).toString() //"3125"
        ExpantaNum.pow("e2e9","e5e9").toString() //"e2.0000007521745653e5000000009"
      

Methods (System)

fromArray

Static: ExpantaNum.fromArray(x[,y])
Instance: None
Takes an Array and optionally a Boolean, and return an ExpantaNum with given properties.

fromHyperE

Static: ExpantaNum.fromHyperE(x)
Instance: None
Takes a String representing Hyper-E Notation and return an ExpantaNum with the corresponding value.
Hyper-E notation syntax:
<syntax>          ::= <signs> <unsigned-syntax>
<unsigned-syntax> ::= <special> | <decimal> | "E" <inside>
<inside>          ::= <decimal> | <inside> "#" <decimal>
<special>         ::= "Infinity" | "NaN"
<signs>           ::= "" | <signs> <sign>
<sign>            ::= "+" | "-"
<decimal>         ::= <integer> | <integer> "." | "." <integer> | <integer> "." <integer>
<integer>         ::= "0" | <nonzero-integer>
<nonzero-integer> ::= <digit> | <nonzero-integer> <digit>
<digit>           ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

fromJSON

Static: ExpantaNum.fromJSON(x)
Instance: None
Takes a JSON in String or an Object and returns the corresponding ExpantaNum.

fromNumber

Static: ExpantaNum.fromNumber(x)
Instance: None
Takes a Number and returns the corresponding ExpantaNum.

fromBigInt

Static: ExpantaNum.fromBigInt(x)
Instance: None
Takes a BigInt and returns the corresponding ExpantaNum.

fromObject

Static: ExpantaNum.fromObject(x)
Instance: None
Takes an Object and returns the corresponding ExpantaNum.

fromString

Static: ExpantaNum.fromString(x)
Instance: None
Takes a String. If it is a Hyper-E notation or is a JSON, uses the corresponding function instead.
Notation syntax otherwise:
<syntax>              ::= <signs> <unsigned-syntax>
<unsigned-syntax>     ::= <special> | <psi-j-syntax> <left-syntax> <scientific-notation>
<psi-j-syntax>        ::= "" | <psi-j-syntax1> | <psi-j-syntax2>
<psi-j-syntax1>       ::= "J" | "J" <psi-j-syntax1>
<psi-j-syntax2>       ::= "J^" <integer<
<left-syntax>         ::= "" | <operator-part> <left-syntax>
<operator-part>       ::= <operator-with-ten> | "(" <operator-with-ten> ")^" <nonzero-integer> " "
<operator-with-ten>   ::= "10" <hyper-operator>
<hyper-operator>      ::= <arrows> | <beaf-operator>
<beaf-operator>       ::= "{" <nonzero-integer> "}"
<arrows>              ::= "^" | <arrows> "^"
<scientific-notation> ::= <signed-decimal> | <signed-decimal> <exponential> <scientific-notation>
<signed-decimal>      ::= <signs> <decimal>
<exponential>         ::= "e" | "E"
<special>             ::= "Infinity" | "NaN"
<signs>               ::= "" | <signs> <sign>
<sign>                ::= "+" | "-"
<decimal>             ::= <integer> | <integer> "." | <integer> "." <integer>
<integer>             ::= "0" | <nonzero-integer>
<nonzero-integer>     ::= <digit> | <nonzero-integer> <digit>
<digit>               ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

ExpantaNum

Static: ExpantaNum.ExpantaNum(x[,y]), ExpantaNum(x[,y])
Instance: None
The constructor of ExpantaNum. Chooses and performs from fromArray, fromHyperE, fromJSON, fromNumber, fromBigInt, fromObject, or fromString accordingly.

standardize

Static: None
Instance: <ExpantaNum>.standardize()
Standardize the properties to match the requirements. Automatically executed on performing methods. Mutating method.

toExponential

Static: None
Instance: <ExpantaNum>.toExponential(places[,applyToOpNums])
An alias for toStringWithDecimalPlaces.

toFixed

Static: None
Instance: <ExpantaNum>.toFixed(places[,applyToOpNums])
An alias for toStringWithDecimalPlaces.

toHyperE

Static: None
Instance: <ExpantaNum>.toHyperE()
Converts into Hyper-E Notation.

        ExpantaNum(52).toHyperE() //"52"
        ExpantaNum("eee30").toHyperE() //"E30#3"
      

toJSON

Static: None
Instance: <ExpantaNum>.toJSON()
Converts into Object with property "array" and "sign".

        ExpantaNum(52).toJSON() //{array:[52],sign:1}
        ExpantaNum("eee30").toJSON() //{array:[30,3],sign:1}
      

toNumber

Static: None
Instance: <ExpantaNum>.toNumber()
Converts the number into Number.

        ExpantaNum(52).toNumber() //52
        ExpantaNum("eee30").toNumber() //Infinity
      

toPrecision

Static: None
Instance: <ExpantaNum>.toPrecision(places[,applyToOpNums])
For small numbers, the number of decimal places to both sides of decimal point combined is fixed. Else, it is an alias for toStringWithDecimalPlaces (1 place removed).

toString

Static: None
Instance: <ExpantaNum>.toString()
Converts the number into String.

        ExpantaNum(100).toString() //"100"
        ExpantaNum([5,3,2,0,0,1]).toString() //"10{5}(10^^)^2 e1e100000"
      

toStringWithDecimalPlaces

Static: None
Instance: <ExpantaNum>.toStringWithDecimalPlaces(places[,applyToOpNums])
Converts the number into String with decimal places.

valueOf

Static: None
Instance: <ExpantaNum>.valueOf()
Converts the ExpantaNum to a primitive or a JSON object. Automatically used for JSON.stringify and casting. Configurable.

Options

debug

NONE 0 Show no information.
NORMAL 1 Show operations.
ALL 2 Show everything.
Setting this will output information on what operations are run to the console. Default is 0 (NONE).

maxOps

Sets the maximum number of operations that are stored to represent a number. Lower value would give lower precision, but would may increase performance working with higher numbers. Default is 1000.

serializeMode

JSON 0 JSON object
STRING 1 String
Sets the mode of what form is used when serializing for JSON.stringify and valueOf. Default is 0 (JSON).