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
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

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
69
S
28
G
24
Posts: 977
Reputation: 18,739

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,461

Post » Mon May 08, 2017 7:08 pm

I don't even think you can have unsigned integers stored in a javascript Number.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

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,461

Post » Mon May 08, 2017 7:15 pm

Aren't bit manipulation limited to 32 bits integers ?
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Mon May 08, 2017 7:16 pm

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


Return to Construct 2 General

Who is online

Users browsing this forum: paxto22, Yahoo [Bot] and 9 guests