For my specific use case, it was required to store numbers in integer representation (so the default Lua number is out of the window). I came across IntValue during my research.
While reading through the attached article, I spotted an inconsistency in the documentation, the description states:
An IntValue is an object that stores a single signed 64-bit integer. Integers do not include decimal points. The highest value that can be stored is 2^63-1, or around 9.2 quintillions. Attempting to store numbers larger than this may cause integer overflow. The lowest value that can be stored is -2^63, or about negative 9.2 quintillions.
While the example code snippet specifically points out, that the max value is 2^31., while the min value is -2^31. I find this to be inconsistent.
-- These are the constraints for a 32-bit signed integer
local INT_MAX = 2 ^ 31 - 1
local INT_MIN = -(2 ^ 31)
local vInteger = Instance.new("IntValue")
vInteger.Changed:Connect(print)
-- Some small values
vInteger.Value = 5
vInteger.Value = 0
vInteger.Value = -0 -- No change - same as 0
-- Min value
vInteger.Value = INT_MIN
-- Max value
vInteger.Value = INT_MAX
-- Max value plus one; this causes integer overflow!
-- The IntValue changes to INT_MIN!
vInteger.Value = INT_MAX + 1
Just to be sure, are IntValues 32 bit, or 64 bit?
IntValue - Creator Documentation
Side Note: I did find an appropriate category to post this in. If an admin can fix this article’s category, it would be really helpful.