Number
An InfiniteMath constructed number that has a limit of -10^^308 to 10^^308.
Functions
SetValue
Number:
SetValue
(
newFirst:
number
,
newSecond:
number
) →
(
)
Sets the value of the constructed number without creating a new Number metatable. If you want to set the value of a constructed number it is better to use this than setting it to a new .new()
.
SetValue
takes a new first
and second
to set the value to, if you want to set the value to 100
you must pass 1, 3
.
local Number = InfiniteMath.new(1000)
print(Number) -- 1000
Number:SetValue(5, 4)
print(Number) -- 5000
Reverse
Number:
Reverse
(
) →
number
Attempts to return the constructed number converted into a regular number. If the constructed number is above 1e+308 it will instead return INF.
print(InfiniteMath.new("1, 3"):Reverse()) -- 1000
GetSuffix
Number:
GetSuffix
(
abbreviation:
boolean
|
nil
) →
string
Returns a string with the number and a suffix at the end, these suffixes will go up to 1e+12000. After, it will default to returning scientific notation.
By default, it will return an abbreviated suffix (1K). Using true will use the default behavior. Using false will return the full suffix (1 Thousand).
print(InfiniteMath.new(1000):GetSuffix()) -- 1K
print(InfiniteMath.new(1000):GetSuffix(true)) -- 1K
print(InfiniteMath.new(1000):GetSuffix(false)) -- 1 Thousand
ScientificNotation
Number:
ScientificNotation
(
abbreviation:
boolean
|
nil
,
secondAbbreviation:
boolean
|
nil
) →
string
Returns a string with the number formatted in scientific notation.
print(InfiniteMath.new(1000):ScientificNotation()) -- 1e+3
When a number reaches 1e+1000000
you can choose an abbreviation mode for the amount of zeros in the scientific notation. By default, it will use GetSuffix on the exponent 1e+1M
, but you can also choose to have it use scientific notation 1e+1e+6
.
print(InfiniteMath.new("1, 1e+6"):ScientificNotation()) -- 1e+1M
print(InfiniteMath.new("1, 1e+6"):ScientificNotation(true)) -- 1e+1M
print(InfiniteMath.new("1, 1e+6"):ScientificNotation(false)) -- 1e+1e+6
You can also use nil and false to stop the functionality and instead just display 1e+1000000
.
print(InfiniteMath.new("1, 1e+6"):ScientificNotation(nil, false)) -- 1e+1000000
LogarithmNotation
Number:
LogarithmNotation
(
) →
string
Returns a string with the number formatted in logarithmic notation.
print(InfiniteMath.new(1000):ScientificNotation()) -- e3.0
aaNotation
Number:
aaNotation
(
) →
string
Returns a string with the number formatted in double letter notation. Use the AALENGTHMAX property to adjust the max letters possible.
print(InfiniteMath.new(1e+15):aaNotation()) -- 1a
ConvertForLeaderboards
Number:
ConvertForLeaderboards
(
) →
number
Returns a number that you can use for OrderedDataStores in order to create global leaderboards that support InfiniteMath constructed numbers.
print(InfiniteMath.new(1000):ConvertForLeaderboards()) -- 31000