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

I no longer maintain version 2 of the module so I will not fix any grammar error, sorry.

oh that’s fine, just thought I would help out a bit

Do you have to tostring() the value before sending it through remote-event/functions? Because I had some issues with sending it through client-server, so I just did tostring(). Would be nice if there was a heads up on this post

You would have to serialise it in some way.

It was not designed for sending remote events, I thought about adding pack/unpack at some point but it never was shipped.

I am sorry, but what is the use of this

2 Likes

you can easily see the use case for this by reading what it does

3 Likes

It’s literally and clearly in the tile: to safely store and represent integers over 253 without precision loss.

Why are you even asking this? How did you even not find any use case for this? (and what would be the alternative?)

2 Likes

No, what I am saying is what’s the point of storing such values?

Feels like you never encountered any such situation, doesn’t mean it does not have any use case. Many algorithms require such values. You ll encounter them when you create your own, or attempt to solve coding problems that require other algorithms. I have personally encountered integer, long and biginteger when coding in Java.

There are infinite numbers. And there are restrictions when coding. But this doesn’t mean numbers don’t exist after that limit. To counter that problem, this module has been made.

1 Like

I have too, but what’s the use of this in Roblox.

I already explained in my reply.

For people in the future who may struggle and rip their hairs out over finding a good “BigNum” or “BigInteger” module, use this very good file: https://github.com/romdotdog/BigInteger.lua/blob/main/BigInteger.lua

The one posted by Blockzez is very… Dodgy. And same with any others really. I’ve had so many issues with these bignum modules and I finally found one that actually works.

1 Like

Sorry for any inconvenience.

I realised this is also a problem with International too (albeit there’s no decent library of it for Luau). I might have to release it as 30 alpha/beta without ever reaching 30 stable and try my best to make it as close to decent but it’ll probably never work properly.

I guess I misleadingly implied that this module is stable because it’s probably not.

My concern with all these kinds of arbitrary precision library is that I’m implementing it by myself which leads to many unnoticed critical bugs.

Can I ask what issue did you find with my and other modules whereas this module is supposedly “decent”? I guess there’s a critical bug or performance issue somewhere, or that something went significantly wrong with the implementation (which I agree and might improve) but you need to be more specific than “I’ve had so many issues”.

I’ll be honest, making an arbitrary precision module is probably easy but making a decent one definitely isn’t.
I might re-implement it, and put a disclaimer that it won’t be stable nor it’ll work properly since I’m the only one creating it but I’m trying my best.
I don’t expertise in this field so don’t completely rely on my modules.
Sorry that I didn’t put any of these disclaimers on.

I am not sure if you wrapped it with a metatable, but if you did you can add and subtract it.

Does this work with global leaderboards (Ordered Datastore)? I’m not that good with math and I can’t tell what everything does.

Hey! Is there any proper way to construct a BigInt from raw bytes? In my use case, I have a table of 32 raw little-endian bytes, which I need to construct a 256 bit integer from.