# How does C2 calculate number, precision-wise?

Discussion and feedback on Construct 2

### » 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
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

### » 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
9
Posts: 339
Reputation: 9,604

### » 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
414
S
245
G
92
Posts: 25,181
Reputation: 200,273