General notice:
This module may not work as well as you might want it to. While using this module, I have found certain issues that can be annoying to work around at times. While the metatables can help out, when using more complicated methods of storing data, such as using a table and sending that table to the client, the metatables will most likely not be carried over to the client, so you’ll need to convert the numbers on the client using number_module.new(number). Issues like these are why I’ve started to work on a new extended number module that should be much more stable and much easier to use, while also adding new features that might be very helpful. If I choose to open source that module, I will insert the link to it in this post once it’s released.
The module:
Hey! I have decided to open source my extended number system module that I’ve been working on all year. This module allows you to use numbers that go so much further than 1.79e+308 (somewhere around 1.79e+308e+1.79e+308). It includes many functions that the math library also includes and can also be used for negative numbers.
How to generally use the module:
To make a new number, you will need to do something like this:
local numbers = require(game.ReplicatedStorage.modules.numbers)
local num = numbers.new
local newNum = num(parameter) -- the parameter can be a table with table.c being the coefficient (gets multiplied by exponent) and table.e being the exponent (10 ^ exponent), a regular number, or a string.
-- example
player.stats.money.Value = tostring(newNum) -- will convert the number (a table) into a string to be used in a StringValue
To convert a number to a string:
tostring(number)
To convert a number to a lua number:
tonumber(tostring(number)) -- if above 1.79e+308 then will return inf
Math operations:
number + number -- equivalent to lua num + lua num
number - number -- equivalent to lua num - lua num
number * number -- equivalent to lua num * lua num
number / number -- equivalent to lua num / lua num
number ^ number -- equivalent to lua num ^ lua num
-number -- equivalent to -lua num or lua num * -1
number == number -- equivalent to lua num == lua num
number <= number -- equivalent to lua num <= lua num
number >= number -- equivalent to lua num >= lua num
number > number -- equivalent to lua num > lua num
number < number -- equivalent to lua num < lua num
#number -- equivalent to #lua num
Abbreviating a number by adding a suffix (such as 1k):
local abbreviated = numbers.tsuf(number) -- this should also work for lua numbers too
Getting a number from an abbreviated string (1k = 1e+3 [1000]):
local numberFromAbbreviation = numbers.fsuf("1k") -- outputs 1e+3 (1000)
Functions/variables from the math library:
-- rounding
numbers.floor -- math.floor
numbers.ceil -- math.ceil
numbers.round -- math.round
-- number manipulation
numbers.abs -- math.abs
numbers.clamp -- math.clamp
numbers.log -- math.log
numbers.max -- math.max
numbers.min -- math.min
-- variables
numbers.huge -- get the largest number from this module, kinda like math.huge
Functions that only work on regular lua numbers:
numbers.notation -- gets the scientific notation of ANY regular lua number
numbers.comma -- turns ANY regular lua number into a formatted string with commas
Please note that if you want to use this commercially, I require you to credit me as such:
The number system in this game was originally made by glitchifyed. To use the system for yourself, please follow this link: UltiNum v1.0 Extended Number Module
Get the module here: https://www.roblox.com/catalog/8000773551