IntValue documentation is Inconsistent

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.

1 Like

Made a quick little google search:
image

Hope it helps!

The problem is that the article says it’s it 64 bits in one location and 32 in another.

@MrMouse2405 if you test it and let me know which one it is, I’ll make a documentation issue report in the appropriate forum

Just tested it by modifying Roblox’s example.

Script:

-- 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
-- It should overflow now...
vInteger.Value = (2 ^ 63 - 1) + 1

Output

  21:48:17.206  5  -  Server
  21:48:17.206  0  -  Server
  21:48:17.206  -2147483648  -  Server
  21:48:17.207  2147483647  -  Server
  21:48:17.207  2147483648  -  Server
  21:48:17.207  -9223372036854776000  -  Server

As you can see, it does not overflow when vInteger.Value = INT_MAX + 1 is executed. But it does when vInteger.Value = (2 ^ 63 - 1) + 1 is executed.

Therefore, it’s 64 signed integer bits. not 32.

I submitted it here