Largest value a global variable can hold

Discussion and feedback on Construct 2

Post » Fri May 05, 2017 11:31 pm

So I noticed that if a number is too big it becomes infinity but there's also a certain size where all of the digits past a certain point become 0. So what's the largest value a global variable (or any variable) can hold accurately?
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Sat May 06, 2017 12:00 am

614889782588491390 It seems like this might be the highest? If I increase the value, even by 1 it gets rounded back down to 614889782588491390
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Sat May 06, 2017 1:54 am

numbers are 64bit floating point values. You probably can get all the info you want by googling that.
B
94
S
33
G
113
Posts: 5,353
Reputation: 73,267

Post » Mon May 08, 2017 5:29 pm

I believe the limits are tied to what javascript can offer, so we have :
Code: Select all
Number.MAX_VALUE => 1.7976931348623157e+308
Number.MIN_VALUE => 5e-324 (smallest value close to 0)
Number.MAX_SAFE_INTEGER => 9007199254740991
Number.MIN_SAFE_INTEGER => -9007199254740991
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Mon May 08, 2017 6:44 pm

Magistross - Unsigned integers have a Javascript limit of 2*MAX_SAFE_INTEGERS - but idk if they are accessible from the IDE
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,471

Post » Mon May 08, 2017 7:08 pm

I don't even think you can have unsigned integers stored in a javascript Number.
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Mon May 08, 2017 7:11 pm

@Magistross, there are a few outside libraries for this, or you can use bit manipulation to simulate them
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,471

Post » Mon May 08, 2017 7:15 pm

Aren't bit manipulation limited to 32 bits integers ?
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Mon May 08, 2017 7:16 pm

@Magistross - true
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,471


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests