A large number library that you can copy-paste directly into your .js file. It is easier to use than traditional libraries, is not very laggy (my game Exotic Matter Dimensions uses it and the lag is minimal) and only takes up around 100 lines of code (60 if you are using Fundamental).
infOP, similarly to logarithmica.numerus by Aarex Tiaokhiao, stores each number as a logarithm - for example, the number 149600000 is stored as 8.174931594 (Such variables are referred to as infNumbers in the code). This allows numbers to go up to 1e1.79e308. The built-in functions make it easy to add, subtract and format these infNumbers.
infOP is split into Fundamental and Advanced versions. The Fundamental version only includes only the Fundamental Functions and is more compact (as well as being easier to use), whereas the Advanced version includes all functions documented here but is a lot longer.
In this documentation and function names, the prefix norm indicates an ordinary number input (5 means 5) and the prefix inf indicates an infNumber input (5 means 100000)
Orangelinks are currently being updated and should not be used to update your version of infOP.
infAdd
This function adds two infNumbers. For example, infAdd(1.743,0.296) will return log(10^1.743+10^0.296), which is 1.758245417.
Syntax: infAdd(x,y) where x and y are the infNumbers you want to add
infSubtract
This function subtracts two infNumbers. For example, infSubtract(1.758,0.296) will return log(10^1.758-10^0.296), which is 1.742745812.
Syntax: infSubtract(x,y) where y is the infNumber you want to subtract from x.
infFormat
This function formats an infNumber as an ordinary number. For example, infFormat(33.374,false) will return 2.36e33, infFormat(23.456,false) will return 287.57 Sx and inf(1.4,false) will return 25.
Syntax: infFormat(x,decimal) where x is the number you want to format and decimal is a boolean - if decimal is enabled, numbers below 10 will retain 2 decimal points instead of being rounded down. So: infFormat(0.75,true) returns 5.62 (helpful for when you want accurate values, for example upgrade effects) infFormat(0.75,false) returns 5 (helpful for when you want integer values, for example styling currency) infFormat(1.3,true) returns 19 (decimal only rounds numbers below 10)
NOTE: infFormat uses mixed scientific notation by default, meaning numbers between 1e3 and 1e33 are formatted with Antimatter Dimensions standard notation by default. To change this, find the Mixed scientific variable in the code for the language you are using and replace it with Scientific or the notation you want. Supported notations are:
Alemaninc Ordinal*
Double Logarithm
Infinity**
Logarithm
Mixed scientific
Scientific
* This is a joke notation, but it isn't "painful" (like some notations in Antimatter Dimensions) and can be useful if your game has uncontrollable growth (or if you're just making an ordinal game)
** This is similar to the Antimatter Dimensions notation but caps at e1.8e308 ("true" infinity) instead of 1.8e308.
normFormat
This function is identical to infFormat, but treats the input as if it were a normal number. So normFormat(2**256) returns 1.15e77 instead of e1.15e77. normFormat only starts using mixed scientific notation past 10000 instead of 1000, so normFormat(1753) still returns 1753.
Also, numbers below 100 are always rounded to 2 decimal digits, so normFormat(31.4159265) returns 31.41 instead of 31. Useful for removing excess digits.
timeFormat
This function formats an amount of seconds as a time - for example, timeFormat(0.753) returns 0.753 seconds, timeFormat(37) returns 37 seconds and timeFormat(90123) returns 1 day 1:02:03.
This is not related to large numbers but is included as part of the code as it is useful if your game includes statistics like many popular incrementals do.
The twoDigits function formats a one-digit number as 2 digits and has very limited practical use.
infMultiply / infDivide / infExponent
These functions do not exist as they can easily be replicated with the basic operators.
infMultiply:infMultiply(x,y) = x+y. As 1e7*1e4=1e11, 7+4=11.
infDivide:infDivide(x,y) = x-y. As 1e9/1e3=1e6, 9-3=6.
infExponent:infExponent(x,y) = x*y assuming x is an infNumber and y is a regular number. As 1e7^4=28, 7*4=28.
normLinearSoftcap
This function linearly softcaps an ordinary number. It takes three inputs: value, start and power in the form normLinearSoftcap(value,start,power). value is the value that is getting softcapped. For example, if the base effect of an upgrade is 10x, you would input 10 here. start is the start of the softcap. For example, if you want diminishing returns past 5x, you would input 5 here. power is how harsh the softcap is. At high values, the function's output is directly proportional to the power+1th root of value. For example, if you want the effect of an upgrade to be cube rooted after a certain point, you would input 2 here.
Unlike many softcapping functions, this function (and the other softcapping functions) see a gradual change in derivative instead of a sudden unexplained slowdown.
Alternatively, power can be negative (for the opposite effect - a number increases faster past a certain value). power must never be less than or equal to -1.
It is recommended to use the Scaling functions for this unless one of your upgrades weakens a softcap to the point of reversing it.
infLinearSoftcap
This function linearly softcaps an infNumber. It takes the same three inputs as normLinearSoftcap - value, start and power and has the same structure. However, value and start are infOP exponents and so is the output. power is still a regular number and can still go below 0 (though not below -1).
This function logarithmically softcaps a number. It still takes three inputs: value, start and power in the form LogarithmicSoftcap(value,start,power). value is the value that is getting softcapped. For example, if the base effect of an upgrade is 10x, you would input 10 here. start is the start of the softcap. For example, if you want diminishing returns past 5x, you would input 5 here. power is how harsh the softcap is. At high values, the function's output is directly proportional to ln(value)^(1/power). For example, if you want a weak softcap, you would input a number such as 0.02 and get ln(value)^50 at very high values.
power cannot be negative for this function. For scaling purposes, use the Scaling functions or make your own.
The result of this function is equal to start*slogₑ((value/start)**(1/power))**power. As a result, if value**power exceeds 1.79e308, the function will break. This will not cause a NaN error and simply return start - however, it is recommended to not use this function with a power of more than 1.
ConvergentSoftcap
This function is different from the other softcapping functions. It takes three inputs: value, start and end, structured as ConvergentSoftcap(value,start,end). Once value exceeds start, it will approach but never reach end. Useful for percentage-based upgrades (to never exceed 100%) or sometimes for other purposes.
This function linearly scales an ordinary number, meaning it increases faster past a certain value. It takes three inputs: value, start and power, structured as normLinearSoftcap(value,start,power).
This function semi-exponentially scales an ordinary number. Semi-exponential scaling is faster than linear scaling, but a lot slower than exponential scaling. It takes three inputs: value, start and power.
The result of this function is equal to start*⁽ᵛᵃˡᵘᵉ/ˢᵗᵃʳᵗ⁾^ᵖᵒʷᵉʳe^(1/power). As a result, if value**power exceeds 1.79e308, the function will break. This will not cause a NaN error and simply return 1.79e308 - however, it is recommended to not use this function with a power of more than 1.
infFloor
This function floors an infNumber. It takes one input, which is x - this is the value getting floored.
This isn't related to infNumbers directly, but can be useful if an infNumber goes below 1 (in which case it is stored as a negative number) and one of your formulas takes the exponent of a logarithm
normSimplex
This is the simplex function for ordinary numbers. normSimplex(x,y) calculates the xth y-simplex number.
This is the simplex function for infNumbers. infSimplex(x,y) where x is an infNumber and y is ordinary will output the base 10 logarithm of the 10^xth y-simplex number.
- infFormat and normFormat now format numbers less than 1,000,000 using commas rather than the set notation
infOP V
- Added support for very small numbers
- Added Tetration notation
- Added functions for outputting triangular numbers, tetrahedral numbers and higher simplex numbers
infOP IV
- ExponentialScaling now takes in a power input
- Added Engineering notation
infOP III
- Added four new infFormat/normFormat notations (Alemaninc Ordinal, Double Logarithm, Logarithm, Infinity)
- Made some code smaller
- convergentSoftcap now supports end being less than start
infOP II
- Added softcap & scaling functions
- Added changelog
- Removed the README file and made an infOP website instead
infOP I
- Initial release
Dates are unavailable as each language updated at different times.