Skip to main content

InfiniteMath

InfiniteMath is module that allows you to surpass the limit of -10^308 to 10^308, with a new limit of -10^^308 to 10^^308 (1 with 10^308 zeros)

InfiniteMath has many of the functions from the math library, as well as metamethods for arithmatic and comparison.

Datastores and OrderedDataStores are supported, with special functions for OrderedDataStores.

Properties

DECIMALPOINTS

InfiniteMath.DECIMALPOINTS: number

How many decimal points are displayed. 1 = 1.0, 2 = 1.00, 3 = 1.000, etc.

AALENGTHMAX

InfiniteMath.AALENGTHMAX: number

The maximum length for suffixes generated for aaNotation conversions. Exceeding this length results in a scientific number instead.

Functions

new

InfiniteMath.new(valnumber | string | table | Number) → Number

Returns a new InfiniteMath constructed number

You can use numbers 1, correctly formatted strings "1,0", tables {1, 0}, and other constructed numbers InfiniteMath.new(1).

	print(InfiniteMath.new(1)) -- 1

To create a number above 1e+308, we can use strings or tables.

	print(InfiniteMath.new("1,1000")) -- 10DTL
	print(InfiniteMath.new({1, 1000})) -- 10DTL

floor

InfiniteMath.floor(Numnumber | string | table | Number) → Number

Rounds a number down to the nearest integer

round

InfiniteMath.round(Numnumber | string | table | Number) → Number

Rounds a number to the nearest integer

ceil

InfiniteMath.ceil(Numnumber | string | table | Number) → Number

Rounds a number up to the nearest integer

abs

InfiniteMath.abs(Numnumber | string | table | Number) → Number

Returns the absolute value (distance from 0)

clamp

InfiniteMath.clamp(
Numnumber | string | table | Number,
Minnumber | string | table | Number,
Maxnumber | string | table | Number
) → Number

Clamps a number between a minimum and maximum value

min

InfiniteMath.min(...number | string | table | Number) → Number

Returns the smallest number among the given arguments

max

InfiniteMath.max(...number | string | table | Number) → Number

Returns the largest number among the given arguments

sign

InfiniteMath.sign(Numnumber | string | table | Number) → number

Returns the sign of the number. Negative numbers return -1, positive numbers return 1, 0 returns 0.

sqrt

InfiniteMath.sqrt(Numnumber | string | table | Number) → Number

Returns the square root of a number

fmod

InfiniteMath.fmod(
anumber | string | table | Number,
bnumber | string | table | Number
) → Number

Returns the remainder of the division of a by b that rounds the quotient towards zero.

modf

InfiniteMath.modf(Numnumber | string | table | Number) → Number

Returns both the integral part of n and the fractional part (if there is one).

log

InfiniteMath.log(
Numnumber | string | table | Number,
Basenumber
) → Number

Returns the logarithm of x with the given base. Default base is constant e (2.7182818)

log10

InfiniteMath.log10(Numnumber | string | table | Number) → Number

Returns the base-10 logarithm of x.

ConvertFromLeaderboards

InfiniteMath:ConvertFromLeaderboards(GivenNumbernumber) → Number

Returns a constructed number, and should be given a number created by Number:ConvertForLeaderboards. This is what you will display on global leaderboards using OrderedDataStores.

	local ValueFromStore = InfiniteMath.new(1000):ConvertForLeaderboards()
	print(InfiniteMath:ConvertFromLeaderboards(ValueFromStore)) -- 1K
Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Returns a new InfiniteMath constructed number\n\nYou can use numbers `1`, correctly formatted strings `\"1,0\"`, tables `{1, 0}`, and other constructed numbers `InfiniteMath.new(1)`.\n\n```lua\n\tprint(InfiniteMath.new(1)) -- 1\n```\n\nTo create a number above 1e+308, we can use strings or tables.\n\n```lua\n\tprint(InfiniteMath.new(\"1,1000\")) -- 10DTL\n\tprint(InfiniteMath.new({1, 1000})) -- 10DTL\n```",
            "params": [
                {
                    "name": "val",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 379,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "ConvertFromLeaderboards",
            "desc": "Returns a constructed number, and should be given a number created by `Number:ConvertForLeaderboards`. This is what you will display on global leaderboards using OrderedDataStores.\n\n```lua\n\tlocal ValueFromStore = InfiniteMath.new(1000):ConvertForLeaderboards()\n\tprint(InfiniteMath:ConvertFromLeaderboards(ValueFromStore)) -- 1K\n```",
            "params": [
                {
                    "name": "GivenNumber",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 702,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "floor",
            "desc": "Rounds a number down to the nearest integer",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 732,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "round",
            "desc": "Rounds a number to the nearest integer",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 750,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "ceil",
            "desc": "Rounds a number up to the nearest integer",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 780,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "abs",
            "desc": "Returns the absolute value (distance from 0)",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 798,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "clamp",
            "desc": "Clamps a number between a minimum and maximum value",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                },
                {
                    "name": "Min",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                },
                {
                    "name": "Max",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 816,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "min",
            "desc": "Returns the smallest number among the given arguments ",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 851,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "max",
            "desc": "Returns the largest number among the given arguments",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 881,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "sign",
            "desc": "Returns the sign of the number. Negative numbers return -1, positive numbers return 1, 0 returns 0.",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 912,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "sqrt",
            "desc": "Returns the square root of a number",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 929,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "fmod",
            "desc": "Returns the remainder of the division of a by b that rounds the quotient towards zero.",
            "params": [
                {
                    "name": "a",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                },
                {
                    "name": "b",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 943,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "modf",
            "desc": "Returns both the integral part of n and the fractional part (if there is one). ",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 961,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "log",
            "desc": "Returns the logarithm of x with the given base. Default base is constant e (2.7182818)",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                },
                {
                    "name": "Base",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 998,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "log10",
            "desc": "Returns the base-10 logarithm of x.",
            "params": [
                {
                    "name": "Num",
                    "desc": "",
                    "lua_type": "number | string | table | Number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1023,
                "path": "src/InfiniteMath/init.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "DECIMALPOINTS",
            "desc": "How many decimal points are displayed. 1 = 1.0, 2 = 1.00, 3 = 1.000, etc.",
            "lua_type": "number",
            "source": {
                "line": 25,
                "path": "src/InfiniteMath/init.lua"
            }
        },
        {
            "name": "AALENGTHMAX",
            "desc": "The maximum length for suffixes generated for aaNotation conversions. Exceeding this length results in a scientific number instead.",
            "lua_type": "number",
            "source": {
                "line": 32,
                "path": "src/InfiniteMath/init.lua"
            }
        }
    ],
    "types": [],
    "name": "InfiniteMath",
    "desc": "InfiniteMath is module that allows you to surpass the limit of -10^308 to 10^308, with a new limit of -10^^308 to 10^^308 (1 with 10^308 zeros)\n\nInfiniteMath has many of the functions from the math library, as well as metamethods for arithmatic and comparison.\n\nDatastores and OrderedDataStores are supported, with special functions for OrderedDataStores.",
    "source": {
        "line": 12,
        "path": "src/InfiniteMath/init.lua"
    }
}