Dekkonot/bitbuffer

[FEAT] read/writeUInt64

Closed this issue · 3 comments

foxt commented

It seems interesting that a data storage system for Roblox can't even store Roblox IDs which have been over 32-bits for over a year.

It would great to see a read/writeUInt64 function added to this library!

Thanks!

This was a deliberate choice. Numbers in Lua are doubles, which have 53 significant bits. Without some sort of bigint implementation (which is well outside of scope), it's impossible to actually have 64 bit integers. I'd rather not lie to people about the precision of integers because it seems like a footgun waiting to happen.

foxt commented

Thanks for your answer. Do you reckon using Float64 is a good substitute? (I'm not too familiar with binary data types so I'm not sure if that's the same as the Lua number type 😅 )

Float64 is another name for a double, so I would use it if you need full precision. Its not interchangable with an Int64 necessarily, but with any number below 2^53 it is.