# How do I use numbers over the limit (9.2Qn)

1. What do you want to achieve? Keep it simple and clear!

I want to create a button game, but there will be numbers over 9.2Qn (ex. like 100Sx)
Buttons that cost more than 9.2Qn(like 10Qn) cant be purchased.

1. What is the issue?

The issue is the number limit. I cant seem to find a solution.

1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have tried to look for other people who had the same problem, I cant seem to find anything helpful

``````Multiplier.Value = Multiplier.Value - 10000000000000000000 --(10Qn)
``````
1 Like

math.pow() i think.

In this case, math.pow(10, 18)
About the number limit, what do you mean with this?

1 Like

You may want to use this module.

For the technically curious, you need to use a table implementation to represent a number beyond 64 bits, where each index of the table represents a radix (places in a number).

Thatâ€™s what this module does.

As a side effect however, this consumes significantly more memory. Use with care.

1 Like

when u do
local Num = 1
you declare a 64bit /8bytes variable which have a max value of
9,007,199,254,740,992

1 Like

If you really want to, you can make a custom 128 bit integer class (supports numbers up to 2^127) using buffers.

The largest number you can print is `math.pow(10,309)`, so you just need a mapper for these giant numbers

oh sorry i didnt clarify it.
The Currency also cant be more than 9.2Qn, so there is no chance of buying a button costin more.
Also the Currency resets once the 9.2Qn is reached

you canot create a 128 bit integer with buffers the maximum is 64 bit

You clearly donâ€™t know how buffers work. A â€śbufferâ€ť is a chunk of memory that can have any size. You can write with offsets to simulate larger numbers.

128bit integer > (64bit + 64bit)

What is that supposed to mean?

128bit integer stores more numbers than 2 64bit numbers combined
2^128 > (2^64 + 2^64)

yes you can use 128 bits but you canot create a 128 bit integer

How does that relate to buffers?

To make a 64 bit integer;

• Make a buffer with the size of 8 bytes `buffer.create(8)`
• Write to offsets (0, 4) with `buf.writeu32()`

To make a 128 bit integer;

• Make a buffer with the size of 16 bytes `buffer.create(16)`
• Write to offsets (0, 4, 8, 12) with `buf.writeu32()`

Theoretically you can do this until you have no memory left.
Yes your math is correct, but we arenâ€™t combining two 64 bit integers. We are using every bit as a power of 2.

1 Like

yeah you are right i didnot think about that i thought about combining 2 integers/:

This doesnâ€™t work though. You canâ€™t read 128 bit integers from a buffer with the current buffer implementation and writing 4 32 bit integers is not the same as writing one 128 bit integer.
The only way this works is by combining the numbers in series which has far less flexibility than a 128 bit integer.

It technically is because 4 chunks of 32 bit memory is just 128 bits. You just need to interpolate the offset bytes and add it to your number correctly. (basically `chunk_value * (2 ^ chunk_offset)`)

And yes, youâ€™re right, this is not a native 128 bit integer class so it wonâ€™t be as optimized as say 32 bit integers. But in this use case, it should work just fine.

is there a reason to not use 2 64bit instead of 4 32bit integers?

64 bit integers are not supported in the buffer library. It only supports up to 32 bits for integers and 64 bits for floats.

1 Like