Bit right shift on integer

So right now I have like a string “1243339929409552477” because lua can’t handle this number, when I tonumber(x) it changes to 1243339929409552400, how to preserve the 77.

Also I wanna do bit rshift of this number (64 bit number), how to do it? Thanks!

I can’t help with the first question, other than point to some open source modules. However, you can do an rshift using bit32.rshift.

Modules

AdvancedDouble - An advanced number library capable of exceeding 10 ^ 308

[2.0.1] BigInteger, safely store and represent values over 2⁵³

InfiniteMath | Go above 10^308/1e+308!

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

But how, if it’s 1243339929409552477, i don’t think this is 32bit integer

Ah, yea, that’s correct. I don’t believe there’s a built-in way to handle numbers this large, unfortunately. Your best bet would be using one of the modules I linked (if they suit your need)

So unfortunately, with the way these modules (including mine) work, they are even more unreliable for storing large numbers accurately than your typical lua number.

This is because they have to forgo high accuracy by using two numbers (a coefficient and an exponent) to perform the calculations necessary, purely so they can be as high as possible.

For most purposes on Roblox accuracy isn’t needed with these large numbers, which is why these work so well especially for things like tycoons and such.

Lua numbers are stored as doubles, meaning they’re not very accurate like an integer would be, and are more akin to that of a float32 or something similar. Unfortunately there isn’t really a way to store large integers like that very accurately on Roblox. Although, I am rather curious about how accurate IntValues are…