How to easily bypass 9.2qt intvalue without BigNum

So I like to make games that goes extreme numbers , it can go up to 9.2 Quintillion (Maximum Roblox IntValue).

Problem is , players wanted more!
so ,I research on how to bypass that limit and stumble across 2 library.

After a few hours of coding using those library , I thought of one thing.
Why don’t I create a STRING VALUE and use it as number , string don’t have any limit.
Example (a car buying script) ;

local CarCost = 1e+105

local player_money = Instance.new(“StringValue”,workspace)

player_money.Value = “9e+105” – more than what IntValue can handle.

player_money.Value = tonumber(player_money.Value) - CarCost

print(player_money.Value) — returns : 8e+105 (player money balance)

So my question here , what is the cons of doing this?
There must be a huge one , that’s why Devs are using RoStrap or BigInteger above right?!

Here is my code in action , the numbers are not 100% accurate … but it get the job done without noticeable difference ;

I have to ask, do you even know what numeric data type is used for Luau numbers? Do you even know what numeric data type tonumber returns?
I also have to ask do you understand the intention of BigInteger? (Oh it doesn’t have to be my BigInteger, do you understand why does ES2020 introduced BigInt data type even though ECMAScript’s “number” is the same data representation as Luau’s “number” except that in Roblox, subnormals are flushed to zero?)
I intended to create BigInteger so to pass the limits of the IEEE 754 double precision, which is the internal representation of Luau “number”, not to bypass IntValue “limits” - I find this weird because there’s no true integer data type (machine or arbitrary) in Luau so instead the source is a double and the internal representation of IntValue is int64_t which can represent 253 + 1 preceisely while doubles can’t making IntValues needless, pointless, and useless; There’s no reason at all to use IntValues.

Which is wrong, computers are not infinite. Like BigInteger, GNU GMP, and other arbitrary precision numeric data types, the limit will be on the memory. Also StringValue can only store up to ~200.000 (ASCII?) characters.
What numeric data type do you mean by “using it as number”?s

Because these kind of people do not need NaN or a subset of rational with the denominator being 2^k but need exact representation of integers over 253.

Which defeats the entire purpose of arbitrary precise integer libraries like BigInteger and GNU GMP. I’ll repeat: the intention of BigInteger is to be an arbitrary precision integer data type that doesn’t suffer from floating point errors unlikes Luau “number” which is represented in the IEEE 754 double precision floating point format therefore it cannot represent certain integers exactly after 253.

For what it’s worth if you don’t really care about precision and mostly have big numbers for the shock value… regular ol’ numbers can store massive numbers just fine—up to about 10^308.

You lose precision, but that’s kinda the point of the data type.

Wow , I understand so little to what you are talking about ! hahahaha

I don’t know what ‘data type’ tonumber returns … all I know is that when I do this tonumber("1e+3’) , it returns a number to which I can use any mathematical math operators on.

as you can see in my game linked above , so far the game works fine calculating huge numbers (up to 9e+200) . I even added a simple leaderboard to save it to datastore.

Bear in mind that I have little to no idea what ‘data-type’ , ‘IEEE 754 double precision’ and etc…

I am about to start a new project real soon with huge numbers (more than 9quintillion)
so I really need someone to keep it simple and tell me the cons of my technique.

well , when a player reach such huge numbers … they don’t really need the number to be super precise right?

That’s good to hear , I limit my number to around 10^200~ anyway .

If I may ask , what’s the point of getting precise when you are in such huge number?
because I don’t see any dev can benefit from such precision.

Yeah, I agree. For your game, and many real world applications, it sounds fine to just lose precision. That’s my point :wink:

Internally, roblox uses a “double-precision floating point” to store all its numbers. It basically stores stuff in scientific notation.

So there’s only like fifty digits it actually can track of, and then it says where to put the decimal place (which might be wayyyy further to the right than the most meaningful digit).

The upshot is that it lets you store very, very small values with a lot of precision, or very very large values with less.

Other developers need precision at high values for whatever reason. So they use things like BigInt.

1 Like

Perfect , That sums up my questions :grin: