Size of int in preferences

I’m wondering what the size of an integer is in the preferences. Mainly because I’d like to store the result of Date.now() in it, but I’m afraid it’ll cause issues if it’s too large.

1 Like

From https://answers.yahoo.com/question/index?qid=20101130100955AAFylZo we see all the max values for differnt bit numbers. JS is supposed to go up to 53bit max, but we can use ctypes.UInt64 but ignoring that lets see what we can do. I created an integer pref and will now try setting it to these values below:

0 = 2^0 = 1

1 = 2^1 = 2

2 = 2^2 = 4

3 = 2^3 = 8

4 = 2^4 = 16

5 = 2^5 = 32

6 = 2^6 = 64

7 = 2^7 = 128

8 = 2^8 = 256

9 = 2^9 = 512

10 = 2^10 = 1024

11 = 2^11 = 2048

12 = 2^12 = 4096

13 = 2^13 = 8192

14 = 2^14 = 16384

15 = 2^15 = 32768

16 = 2^16 = 65536

17 = 2^17 = 131072

18 = 2^18 = 262144

19 = 2^19 = 524288

20 = 2^20 = 1048576

21 = 2^21 = 2097152

22 = 2^22 = 4194304

23 = 2^23 = 8388608

24 = 2^24 = 16777216

25 = 2^25 = 33554432

26 = 2^26 = 67108864

27 = 2^27 = 134217728

28 = 2^28 = 268435456

29 = 2^29 = 536870912

30 = 2^30 = 1073741824

31 = 2^31 = 2147483648

32 = 2^32 = 4294967296

33 = 2^33 = 8589934592

34 = 2^34 = 17179869184

35 = 2^35 = 34359738368

36 = 2^36 = 68719476736

37 = 2^37 = 137438953472

38 = 2^38 = 274877906944

39 = 2^39 = 549755813888

40 = 2^40 = 1099511627776

41 = 2^41 = 2199023255552

42 = 2^42 = 4398046511104

43 = 2^43 = 8796093022208

44 = 2^44 = 17592186044416

45 = 2^45 = 35184372088832

46 = 2^46 = 70368744177664

47 = 2^47 = 140737488355328

48 = 2^48 = 281474976710656

49 = 2^49 = 562949953421312

50 = 2^50 = 1125899906842624

51 = 2^51 = 2251799813685248

52 = 2^52 = 4503599627370496

53 = 2^53 = 9007199254740992

54 = 2^54 = 1.80143985095e16

55 = 2^55 = 3.6028797019e16

56 = 2^56 = 7.20575940379e16

57 = 2^57 = 1.44115188076e17

58 = 2^58 = 2.88230376152e17

59 = 2^59 = 5.76460752303e17

60 = 2^60 = 1.15292150461e18

61 = 2^61 = 2.30584300921e18

62 = 2^62 = 4.61168601843e18

63 = 2^63 = 9.22337203685e18

64 = 2^64 = 1.84467440737e19

1 Like

From trial and error it handles 32bit only, the lowest is -2147483648 and highest is 2147483647 if you try setting it outside of that, you get an error saying “The text you entered is not a number.”.

1 Like

Heh, seems we passed that cutoff a long time ago. Strings it is.