Calculate up to 10 ↑↑ 1e+308
10 ↑↑ 1e+308
AlephNum is a roblox number module inspired by other libraries like InfiniteMath and especially EternityNum. The name is inspired by the widely known transfinite number, Aleph-Null.
Explanation
AlephNum stores numbers in tables. Each AN table has 4 values: Sign, Mantissa, Exp, and Layer.
The number format is explained better on the Github Page, but compressing numbers this way lets it represent numbers way above the old limit (1e+308) and all the way up to 10 ↑↑ 1e+308 as shown above.
Usage
AlephNum uses metamethods and methods, which allow you to do things like this:
local value = AlephNum.fromNumber(2)
value:pow(1024) -- Does 2^1024 (1.797e308)
value *= 2 -- Does 2 * 2^1024
print(value:toScientific(3)) -- Prints "3.595e308"
Along with that, AlephNum has a config system, which you can change using AlephNum.setConfig. These are the current config options available:
AlephNum.Config = {
["StrictMode"] = false, -- If true, the script will halt instead of give warnings when things go wrong.
["Notation"] = "Scientific", -- Scientific (1e10), Suffix (1T), or None (100000000000000000000...)
["SciNotation"] = "None", -- None (1e1000000000000), Scientific (1e2e3e10), or Suffix (1e20k)
["Threshold"] = 1e3, -- How big a number needs to be to be abbreviated into the Notation.
["SciThreshold"] = 10, -- Caps out scientific abbreviated numbers from being too long (2e1e1e1e1e1e1e1e1e1e1e1e1e10 vs 2 * 10 ^^ 14)
["Digits"] = 2, -- How many decimal places are shown (1k or 1.23k or 1.234567k, etc.)
}
And also, on the unfortunate case that your script errors due to misuse on your part, dont worry! Most scripts send out an internal error where you cannot fix it. This script shows you the exact script and line thats causing the issue!
10:31:30.585 ┏ [AlephNum] Division by zero! Defaulting to zero. - Server - AlephNum:1466
10:31:30.585 ┗ ╸ Go to script: ServerScriptService.Server on line 7 to fix this. - Server - AlephNum:1467
Also, to check if there is a newer version out there, you can put AlephNum.checkVersion() at the top of your code!
Keep in mind, this does an HTTP request to the github releases, so you need to have HTTP requests on for this to work.
Why?
Why would you ever use AlephNum when other more popular libraries exist? Well, there are multiple reasons.
Sure, AlephNum doesnt have the biggest limits ever or the fastest code possible, but atleast it is developer friendly. The entire reason I am making this library is because I’m tired of other old libraries having bad source code and bad error output, etc. and I wanted developers who are new to navigating big numbers to have an easier time.
But, in case you dont care about all that, here are some other reasons why you should use AlephNum:
- AlephNum is OrderedDataStore compatible up to
9e999, meanwhile without this you’d be stuck at9.2e18! - AlephNum is more precise than EternityNum in most cases!
- AlephNum has a higher limit than InfiniteMath by a long shot! (
10 ↑↑ 1e+308>10^1e+308) - AlephNum can handle bigger operations than QuickNum!
- AlephNum is constantly being worked on and isn’t outdated like most of its competitors!
- and theres probably more reasons, but you get the point…
How to Install
You can get AlephNum from the latest release from Github, or by adding this to your wally dependencies list:
AlephNum = "archadiumm/alephnum@2.0.1"
