How does C2 calculate number, precision-wise?

Discussion and feedback on Construct 2

Post » Sun Jul 21, 2013 5:44 am

Just curious here, are the number variables we are using double, float, or something else?

How many digits of number can we go for, until we start to have a little round off error, precision error, etc?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Sun Jul 21, 2013 5:52 am

Now Ashley can correct me if I'm wrong, but I believe C2 just uses JavaScript's logic and datatypes. Now JS is an untyped, or dynamically typed language. That means that you generally don't declare what type a variable is going to be, it's taken care of behind the scenes. This makes predicting round of errors and precision errors a nightmare because it's all guesswork on what type JS is choosing at that point in time. As a general rule, JS will pick the most suitable type, so:

"asdasd" = string
65161 = int
65651651684651654165168416517165141651 = long
1/3 = double
1/4 = float
B
55
S
12
G
8
Posts: 339
Reputation: 9,334

Post » Sun Jul 21, 2013 4:15 pm

Construct 2 leaves number calculations to the Javascript engine, and Javascript is standardising as only supporting double precision floats for numbers.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,464


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests