Numbers past 1.79e+308 | Extended number module (open source)

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 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 =

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 = tostring(newNum) -- will convert the number (a table) into a string to be used in a StringValue

To convert a number to a string:


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: Numbers past 1.79e+308 | Extended number module (open source)

Get the module here: Extended number system (>1.79e+308) - Roblox


May I ask, what’s the motivation for this?
What number set is this supposed to represent? Integers? Rationals? Reals?

Where did you get 1.7 * 10308 from?

How would you increase the limit? By increasing bits of the biased exponent?
How did you come up the new limit?

Why the “largest number”? Why not IEEE Infinity? math.huge's name is from C’s HUGE_VAL (I believe), thus it is a special value, IEEE Infinity.

You seem to imply Lua VM “number” is represented in decimal rather than binary.

Looking at the script:

math["floor" or math.abs(num.c) == num.c and "floor" or "ceil"](math.log10(math.abs(num.c)))

Why use the [] syntax on what is intended to be a module (math)?
It’s the same reason why we don’t do getattr(math, ...) in Python.


This module was intended to be made for games like Miner’s Haven, as I noticed many players of Miner’s Haven were easily hitting the double-precision floating-point limit of around 1.79 * 10 ^ 308. I’ve been using 2 numbers, a coefficient float and an exponent double inside a lua dictionary. I got the rough maximum number through testing in Roblox Studio and in this Wikipedia article which is said to be 2 ^ 1024 - 1. I don’t represent it in binary as it’s harder to people to understand and I find it harder to remember.

I don’t quite remember why I used the [] syntax on the math library in this way when it appears to not make any sense so I may go back and change it. I wrote this module a couple months ago and I have been busy since then. I see the error in making this open source without giving it a proper check after these past few months and may check over my code and fix any mistakes I made.

I was using this system as an alternative to the regular lua number system as I found doubles quite limiting for certain game types that have a cash value as a lot of them were about to exceed the limitations. I don’t intend on people using this module for every single number they want in their game, rather just the ones that need it.

I’m not sure how well this answer will do in answering your questions but please let me know if I said anything wrong. I’m still looking for feedback and I don’t know much outside of lua. I may have made a mistake pushing this out to the public.

In terms of what you said here I have very little experience in Python so I may have to do some research on this in the near future.

Thank you for the feedback, it’s left me a lot to consider about the future of this module.


How would I use this for a simulator leaderboard?

I don’t think you would be able to use ordered data stores in that way.

1 Like

I have updated the module because I found and fixed a minor issue in its code. If it hasn’t been tampered with it can simply replace your previous copy of the module.

(2^1024)-1, the integer limit in Luau

i mean youd never need to go over these values unless ur making some simulator with big numbers

(or something like miners haven), but yeah i agree

would this work all the time like for instance a simulator?

I don’t quite understand the purpose of this. Is it just a method to display large numbers? Why not just suffix them with “k”, “m”, “b”, etc?

There is a limit to how big a number can usually get in luau. However, this module allows you to go past said limit.

1 Like

its designed for big numbers for simulators and things. just dont use it too much

it allows you to use numbers larger than the regular numbervalue limit

1 Like

well theres the money suffix script in miners haven would i just replace the code with the stuff like that?

no. you have to modify a whole bunch of code to replace something like the numbers in the miners haven open source. ive tried in the past but its just too much work for a single person

doesnt sound like much rlly like rlly

the miners haven open source…:joy: buddy you should rlly find the updated one that the people made hold on ill give it to you in a personal message

well based off of the official miners haven open source code, you would have to edit hundreds of scripts just in items alone. you would have to edit dozens of scripts in serverscriptservice and dozens of localscripts to implement the system correctly

I have made a small update to the module that removes a few functions to make it less cluttered. I have also replaced unnecessary division with multiplication to make the module slightly more efficient. (this optimisation was removed due to weird formatting issues)